Created
November 29, 2011 22:37
-
-
Save daniel-nelson/1406923 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| require 'spec_helper' | |
| describe "change my password" do | |
| before(:each) do | |
| @user = Factory(:user) | |
| i_sign_in(@user) | |
| visit edit_user_registration_path | |
| end | |
| it "should require my current password" do | |
| fill_in('Password', :with => 'modified') | |
| fill_in('Password confirmation', :with => 'modified') | |
| click_button('Update') | |
| page.should have_content("Current password (required to change password or email address)can't be blank") | |
| end | |
| it "should notify me when my current password is incorrect" do | |
| fill_in('Password', :with => 'modified') | |
| fill_in('Password confirmation', :with => 'modified') | |
| fill_in('Current password', :with => 'incorrect') | |
| click_button('Update') | |
| page.should have_content("Current password (required to change password or email address)is invalid") | |
| end | |
| it "should change my password when my current password is correct" do | |
| fill_in('Password', :with => 'modified') | |
| fill_in('Password confirmation', :with => 'modified') | |
| fill_in('Current password', :with => 'secret') | |
| click_button('Update') | |
| @user.reload | |
| @user.valid_password?('modified').should be_true | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment