Advertisement
Guest User

Untitled

a guest
Nov 1st, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. require 'test_helper'
  2.  
  3. class UsersSignupTest < ActionDispatch::IntegrationTest
  4. def setupd
  5. ActionMailer::Base.deliveries.clear
  6. end
  7.  
  8. test "invalid signup information" do
  9. get signup_path
  10. assert_no_difference 'User.count' do
  11. post users_path, user: { name: "",
  12. email: "user@invalid",
  13. password: "foo",
  14. password_confirmation: "bar" }
  15. end
  16. assert_template "users/new"
  17. end
  18.  
  19. test "valid signup information with account activation" do
  20. get signup_path
  21. assert_difference 'User.count', 1 do
  22. post users_path, user: { name: "Example User",
  23. email: "user@example.com",
  24. password: "password",
  25. password_confirmation: "password" }
  26. end
  27.  
  28. assert_equal 1, ActionMailer::Base.deliveries.size
  29. user = assigns(:user)
  30. assert_not user.activated?
  31. log_in_as(user)
  32. assert_not is_logged_in?
  33. # get edit_account_activation_path('invalid token')
  34. # assert_not is_logged_in?
  35. # get edit_account_activation_path(user.activation_token, email: 'wrong')
  36. # assert_not is_logged_in?
  37. # get edit_account_activation_path(user.activation_token, email: user.email)
  38. # assert user.reload.activated?
  39. # follow_redirect!
  40. # assert_template "users/show"
  41. # assert is_logged_in?
  42. end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement