diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-09-24 11:48:36 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-09-24 11:48:36 +0400 |
commit | 642398285d21221186ad988198e85a5b60838f86 (patch) | |
tree | bc43a955d31f3cc023ef68bd2f837f9d6acba207 /features | |
parent | 0630be3828998af1261b87ae85b42c0ef9a439ed (diff) |
Force user to provide old password in order to change it
Diffstat (limited to 'features')
-rw-r--r-- | features/profile/profile.feature | 6 | ||||
-rw-r--r-- | features/steps/profile/profile.rb | 18 |
2 files changed, 24 insertions, 0 deletions
diff --git a/features/profile/profile.feature b/features/profile/profile.feature index 3b61552a73d..c74b0993fb3 100644 --- a/features/profile/profile.feature +++ b/features/profile/profile.feature @@ -11,6 +11,12 @@ Feature: Profile Then I change my contact info And I should see new contact info + Scenario: I change my password without old one + Given I visit profile account page + When I try change my password w/o old one + Then I should see a missing password error message + And I should be redirected to account page + Scenario: I change my password Given I visit profile account page Then I change my password diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb index 6944977c3ff..5b2a6321265 100644 --- a/features/steps/profile/profile.rb +++ b/features/steps/profile/profile.rb @@ -22,8 +22,17 @@ class Profile < Spinach::FeatureSteps @user.twitter.should == 'testtwitter' end + step 'I try change my password w/o old one' do + within '.update-password' do + fill_in "user_password", with: "222333" + fill_in "user_password_confirmation", with: "222333" + click_button "Save" + end + end + step 'I change my password' do within '.update-password' do + fill_in "user_current_password", with: "123456" fill_in "user_password", with: "222333" fill_in "user_password_confirmation", with: "222333" click_button "Save" @@ -32,12 +41,17 @@ class Profile < Spinach::FeatureSteps step 'I unsuccessfully change my password' do within '.update-password' do + fill_in "user_current_password", with: "123456" fill_in "user_password", with: "password" fill_in "user_password_confirmation", with: "confirmation" click_button "Save" end end + step "I should see a missing password error message" do + page.should have_content "You must provide a valid current password" + end + step "I should see a password error message" do page.should have_content "Password doesn't match confirmation" end @@ -110,6 +124,10 @@ class Profile < Spinach::FeatureSteps current_path.should == new_user_session_path end + step 'I should be redirected to account page' do + current_path.should == account_profile_path + end + step 'I click on my profile picture' do click_link 'profile-pic' end |