Guest User

Untitled

a guest
Apr 24th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. describe "As a visitor I want to be able to signup" do
  2.  
  3. def visit_and_fill_signup_form(valid = true)
  4. visit root_url
  5. click_link "Sign Up"
  6. fill_in "Name", :with => "Test User"
  7. fill_in "Email", :with => "test@test.com"
  8. fill_in "Password", :with => "123mudar"
  9. fill_in "Password Confirmation", :with => "123mudar" if valid
  10. click_button "Save"
  11. end
  12.  
  13. def confirmation_path
  14. user_confirmation_path(:confirmation_token => User.find_by_email("test@test.com").confirmation_token)
  15. end
  16.  
  17. it "should sign up, confirm account and get signed in" do
  18. visit_and_fill_signup_form(true)
  19. response.should contain "User was successfully created"
  20. visit confirmation_path
  21. response.should contain "Your account was successfully confirmed. You are now signed in."
  22. response.should contain "Hello Test User!"
  23. end
  24.  
  25. it "should see an error message with invalid params" do
  26. visit_and_fill_signup_form(false)
  27. response.should contain "prohibited this user from being saved"
  28. end
  29.  
  30. end
Add Comment
Please, Sign In to add comment