Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- test "new user form exists" do
- # Verify the form exists correctly.
- get :new
- assert_response :success
- assert_select 'form#new_user'
- assert_select 'input#username'
- assert_select 'input#password1'
- assert_select 'input#password2'
- assert_select 'input#email'
- end
- test "creating a user account" do
- username = 'testuser'
- password = 'abc123'
- email = 'test@user.com'
- # Verify that no user exists with this username or email.
- assert_nil User.find_by_username(username)
- assert_nil User.find_by_email(email)
- # Create the new user.
- post :create, :username => username, :password1 => password, :password2 => password, :email => email
- assert_response :redirect
- assert_redirected_to :controller => :entries, :action => :index
- # Verify the new user exists.
- new_user = User.authenticate(username, password)
- assert new_user
- assert_equal email, new_user.email
- end
Add Comment
Please, Sign In to add comment