Guest User

Untitled

a guest
Mar 24th, 2015
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.19 KB | None | 0 0
  1. require 'rails_helper'
  2.  
  3.   describe User do
  4.  
  5.     it "Display message register allow only with invites" do
  6.       visit "/"
  7.       click_link "Регистрация"
  8.  
  9.       expect(page.find('.alert')).to have_content 'Регистрация только по инвайтам'
  10.     end
  11.  
  12.     it 'User need to have a phone number' do
  13.       user = create(:user)
  14.       visit "/users/sign_in"
  15.       fill_in "Email", :with => user.email
  16.       fill_in "Password", :with => "secretpassword"
  17.       click_button "Log In"
  18.       visit '/'
  19.  
  20.       expect(page).to have_content 'Пожалуйста, добавьте номер телефона в своем профиле'
  21.     end
  22.  
  23.     it "Validation phone number false" do
  24.       user = create(:user)
  25.       visit "/users/sign_in"
  26.       fill_in "Email", :with => user.email
  27.       fill_in "Password", :with => "secretpassword"
  28.       click_button "Log In"
  29.       visit '/users/edit'
  30.       fill_in "Phone", :with => 123
  31.       click_button "Обновить"
  32.       expect(page).to have_content 'is too short (minimum is 4 characters)'
  33.     end
  34.  
  35.     it "Validation phone number true" do
  36.       user = create(:user)
  37.       visit "/users/sign_in"
  38.       fill_in "Email", :with => user.email
  39.       fill_in "Password", :with => "secretpassword"
  40.       click_button "Log In"
  41.       visit '/users/edit'
  42.       fill_in "Phone", :with => 1233456
  43.       click_button "Обновить"
  44.       expect(page).to have_content 'Your account has been updated successfully.'
  45.     end
  46.  
  47.     it "Sign in with admin access" do
  48.       user = create(:admin)
  49.       visit "/users/sign_in"
  50.       fill_in "Email", :with => user.email
  51.       fill_in "Password", :with => "secretpassword"
  52.       click_button "Log In"
  53.       visit '/'
  54.  
  55.       expect(page).to have_content "Добро пожаловать #{user.email} (админ)"
  56.     end
  57.  
  58.     it "Sign in without admin access" do
  59.       user = create(:user)
  60.       visit "/users/sign_in"
  61.       fill_in "Email", :with => user.email
  62.       fill_in "Password", :with => "secretpassword"
  63.       click_button "Log In"
  64.       visit '/'
  65.  
  66.       expect(page).not_to have_content "Добро пожаловать #{user.email} (админ)"
  67.     end
  68.  
  69. end
Advertisement
Add Comment
Please, Sign In to add comment