Guest User

Untitled

a guest
Oct 2nd, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. module UserMacros
  2. def create_and_authenticate_user
  3. @current_user = User.find_by_username('test')
  4. @current_user ||= User.create!(:username => 'test',
  5. :password => 'test',
  6. :password_confirmation => 'test')
  7. visit login_path
  8. fill_in 'username', :with => 'test'
  9. fill_in 'password', :with => 'test'
  10. click_button 'Log in'
  11. current_path.should == root_path
  12. end
  13. end
Add Comment
Please, Sign In to add comment