Created
July 23, 2009 16:19
-
-
Save alexmchale/153150 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment