DmitrS

session spec

May 11th, 2017
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.47 KB | None | 0 0
  1. require 'rails_helper'
  2.  
  3. RSpec.describe 'home page', type: :request do
  4.   it 'displays the users username after successful login, hide after logout' do
  5.     user = FactoryGirl.build(:user)
  6.     user.save
  7.     visit '/login'
  8.     fill_in 'session_email', with: user.email
  9.     fill_in 'session_password', with: 'swordfish'
  10.     click_button 'Login'
  11.     expect(page).to have_content user.name
  12.     click_link 'Logout'
  13.     expect(page).not_to have_content user.name
  14.   end
  15. end
Add Comment
Please, Sign In to add comment