Guest User

Untitled

a guest
Mar 17th, 2018
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. require 'test_helper'
  2.  
  3. class AccountsControllerTest < ActionController::TestCase
  4.  
  5. def setup
  6. @valid_params = {:username => "foo",
  7. :password => "secret",
  8. :password_confirmation => "secret",
  9. :email => "foo@example.com"}
  10. end
  11.  
  12. def test_new
  13. get :new
  14. assert_template 'new'
  15. end
  16.  
  17. def test_create_invalid
  18. post :create, :account => {}
  19. assert_template 'new'
  20. end
  21.  
  22. def test_create_valid
  23. post :create, :account => @valid_params
  24. assert_redirected_to root_url
  25. assert_equal assigns['account'].id, session['account_id']
  26. end
  27.  
  28. end
Add Comment
Please, Sign In to add comment