Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rails_helper'
- describe User do
- it "Display message register allow only with invites" do
- visit "/"
- click_link "Регистрация"
- expect(page.find('.alert')).to have_content 'Регистрация только по инвайтам'
- end
- it 'User need to have a phone number' do
- user = create(:user)
- visit "/users/sign_in"
- fill_in "Email", :with => user.email
- fill_in "Password", :with => "secretpassword"
- click_button "Log In"
- visit '/'
- expect(page).to have_content 'Пожалуйста, добавьте номер телефона в своем профиле'
- end
- it "Validation phone number false" do
- user = create(:user)
- visit "/users/sign_in"
- fill_in "Email", :with => user.email
- fill_in "Password", :with => "secretpassword"
- click_button "Log In"
- visit '/users/edit'
- fill_in "Phone", :with => 123
- click_button "Обновить"
- expect(page).to have_content 'is too short (minimum is 4 characters)'
- end
- it "Validation phone number true" do
- user = create(:user)
- visit "/users/sign_in"
- fill_in "Email", :with => user.email
- fill_in "Password", :with => "secretpassword"
- click_button "Log In"
- visit '/users/edit'
- fill_in "Phone", :with => 1233456
- click_button "Обновить"
- expect(page).to have_content 'Your account has been updated successfully.'
- end
- it "Sign in with admin access" do
- user = create(:admin)
- visit "/users/sign_in"
- fill_in "Email", :with => user.email
- fill_in "Password", :with => "secretpassword"
- click_button "Log In"
- visit '/'
- expect(page).to have_content "Добро пожаловать #{user.email} (админ)"
- end
- it "Sign in without admin access" do
- user = create(:user)
- visit "/users/sign_in"
- fill_in "Email", :with => user.email
- fill_in "Password", :with => "secretpassword"
- click_button "Log In"
- visit '/'
- expect(page).not_to have_content "Добро пожаловать #{user.email} (админ)"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment