Skip to content

Instantly share code, notes, and snippets.

@joshsmith
Created October 26, 2012 04:23
Show Gist options
  • Select an option

  • Save joshsmith/3956800 to your computer and use it in GitHub Desktop.

Select an option

Save joshsmith/3956800 to your computer and use it in GitHub Desktop.
require 'spec_helper'
feature 'Reset password' do
attr_accessor :current_email_address
scenario 'Successful password reset' do
user = create(:user)
original_password = user.password
visit '/signin'
click_link "Forgot your password?"
fill_in "Email", :with => user.email
click_button "Send me reset password instructions"
self.current_email_address = user.email
unread_emails_for(user.email).should be_present
open_email user.email, :with_subject => "Reset password instructions"
click_first_link_in_email
page.should have_content("Change your password")
fill_in "New password", :with => "newpassword"
fill_in "Confirm new password", :with => "newpassword"
click_button "Change my password"
page.should have_content("Your password was changed successfully. You are now signed in.")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment