diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb index 2b8e18f6286afb432fa3d7c503aa255fff401465..38cfa896b1151bec95661dc26e373f4a66ce1881 100644 --- a/app/controllers/profile_controller.rb +++ b/app/controllers/profile_controller.rb @@ -22,7 +22,7 @@ class ProfileController < ApplicationController flash[:notice] = "Password was successfully updated. Please login with it" redirect_to new_user_session_path else - render action: "password" + render 'account' end end diff --git a/features/profile/profile.feature b/features/profile/profile.feature index d07a6db1a7958530d66800fe9a789dda76500378..a98988b8ded7bf4d50210b4aec45be710049c5df 100644 --- a/features/profile/profile.feature +++ b/features/profile/profile.feature @@ -16,6 +16,11 @@ Feature: Profile Then I change my password And I should be redirected to sign in page + Scenario: I unsuccessfully change my password + Given I visit profile account page + When I unsuccessfully change my password + Then I should see a password error message + Scenario: I reset my token Given I visit profile account page Then I reset my token diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb index 605936ba55eb66a4518c44146773773b605b4127..efab10104812fa7e9bb33d144d191e035416c5bd 100644 --- a/features/steps/profile/profile.rb +++ b/features/steps/profile/profile.rb @@ -28,6 +28,16 @@ class Profile < Spinach::FeatureSteps click_button "Save" end + When 'I unsuccessfully change my password' do + fill_in "user_password", with: "password" + fill_in "user_password_confirmation", with: "confirmation" + click_button "Save" + end + + Then "I should see a password error message" do + page.should have_content "Password doesn't match confirmation" + end + And 'I should be redirected to sign in page' do current_path.should == new_user_session_path end