Commit 89d9319a791fd49dea734414bdbfe840816fb14c

Authored by Robert Speicher
1 parent f8e27b92

Fix rendered action for password change failure

Closes #1912
app/controllers/profile_controller.rb
@@ -22,7 +22,7 @@ class ProfileController < ApplicationController @@ -22,7 +22,7 @@ class ProfileController < ApplicationController
22 flash[:notice] = "Password was successfully updated. Please login with it" 22 flash[:notice] = "Password was successfully updated. Please login with it"
23 redirect_to new_user_session_path 23 redirect_to new_user_session_path
24 else 24 else
25 - render action: "password" 25 + render 'account'
26 end 26 end
27 end 27 end
28 28
features/profile/profile.feature
@@ -16,6 +16,11 @@ Feature: Profile @@ -16,6 +16,11 @@ Feature: Profile
16 Then I change my password 16 Then I change my password
17 And I should be redirected to sign in page 17 And I should be redirected to sign in page
18 18
  19 + Scenario: I unsuccessfully change my password
  20 + Given I visit profile account page
  21 + When I unsuccessfully change my password
  22 + Then I should see a password error message
  23 +
19 Scenario: I reset my token 24 Scenario: I reset my token
20 Given I visit profile account page 25 Given I visit profile account page
21 Then I reset my token 26 Then I reset my token
features/steps/profile/profile.rb
@@ -28,6 +28,16 @@ class Profile < Spinach::FeatureSteps @@ -28,6 +28,16 @@ class Profile < Spinach::FeatureSteps
28 click_button "Save" 28 click_button "Save"
29 end 29 end
30 30
  31 + When 'I unsuccessfully change my password' do
  32 + fill_in "user_password", with: "password"
  33 + fill_in "user_password_confirmation", with: "confirmation"
  34 + click_button "Save"
  35 + end
  36 +
  37 + Then "I should see a password error message" do
  38 + page.should have_content "Password doesn't match confirmation"
  39 + end
  40 +
31 And 'I should be redirected to sign in page' do 41 And 'I should be redirected to sign in page' do
32 current_path.should == new_user_session_path 42 current_path.should == new_user_session_path
33 end 43 end