Skip to content

Instantly share code, notes, and snippets.

@mhfs
Created November 13, 2009 22:00
Show Gist options
  • Select an option

  • Save mhfs/234214 to your computer and use it in GitHub Desktop.

Select an option

Save mhfs/234214 to your computer and use it in GitHub Desktop.
describe "As a visitor I want to be able to signup" do
def visit_and_fill_signup_form(valid = true)
visit root_url
click_link "Sign Up"
fill_in "Name", :with => "Test User"
fill_in "Email", :with => "[email protected]"
fill_in "Password", :with => "123mudar"
fill_in "Password Confirmation", :with => "123mudar" if valid
click_button "Save"
end
def confirmation_path
user_confirmation_path(:confirmation_token => User.find_by_email("[email protected]").confirmation_token)
end
it "should sign up, confirm account and get signed in" do
visit_and_fill_signup_form(true)
response.should contain "User was successfully created"
visit confirmation_path
response.should contain "Your account was successfully confirmed. You are now signed in."
response.should contain "Hello Test User!"
end
it "should see an error message with invalid params" do
visit_and_fill_signup_form(false)
response.should contain "prohibited this user from being saved"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment