Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. describe 'A new user', js: true do
  2. before do
  3. @new_user = Fabricate.build(:user)
  4. end
  5.  
  6. it 'should sign up' do
  7. #login code
  8. visit '/'
  9. click_link 'Login'
  10. fill_in 'user[email]', :with => @new_user.email
  11. fill_in 'user[password]', :with => @new_user.password
  12. click_button 'Login now'
  13. #login code end
  14.  
  15. page.should have_content("Hello #{@new_user.first_name}!")
  16. current_path.should == dashboard_path
  17. end
  18.  
  19. it 'should receive a confirmation mail' do
  20. #same login code again
  21. visit '/'
  22. click_link 'Login'
  23. fill_in 'user[email]', :with => @new_user.email
  24. fill_in 'user[password]', :with => @new_user.password
  25. click_button 'Login now'
  26.  
  27. mail = ActionMailer::Base.deliveries.last
  28. assert_equal @new_user.email, mail['to'].to_s
  29. end
  30. end
  31.  
  32. it 'should do something after login' do
  33. do_login
  34. #test code here
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement