Commit e50c0d5cb7bcdc1131dae8cd5d5de2947732cda8

Authored by Dmitriy Zaporozhets
1 parent ffec158d

Fix spinach profile tests

app/controllers/profiles/passwords_controller.rb
1 1 class Profiles::PasswordsController < ApplicationController
2 2 layout :determine_layout
3 3  
4   - skip_before_filter :check_password_expiration
  4 + skip_before_filter :check_password_expiration, only: [:new, :create]
5 5  
6 6 before_filter :set_user
7 7 before_filter :set_title
... ... @@ -44,7 +44,7 @@ class Profiles::PasswordsController &lt; ApplicationController
44 44 flash[:notice] = "Password was successfully updated. Please login with it"
45 45 redirect_to new_user_session_path
46 46 else
47   - render 'account'
  47 + render 'edit'
48 48 end
49 49 end
50 50  
... ...
features/profile/profile.feature
... ... @@ -12,13 +12,13 @@ Feature: Profile
12 12 And I should see new contact info
13 13  
14 14 Scenario: I change my password without old one
15   - Given I visit profile account page
  15 + Given I visit profile password page
16 16 When I try change my password w/o old one
17 17 Then I should see a missing password error message
18   - And I should be redirected to account page
  18 + And I should be redirected to password page
19 19  
20 20 Scenario: I change my password
21   - Given I visit profile account page
  21 + Given I visit profile password page
22 22 Then I change my password
23 23 And I should be redirected to sign in page
24 24  
... ... @@ -30,13 +30,13 @@ Feature: Profile
30 30 Scenario: My password is expired
31 31 Given my password is expired
32 32 And I am not an ldap user
33   - And I visit profile account page
  33 + Given I visit profile password page
34 34 Then I redirected to expired password page
35 35 And I submit new password
36 36 And I redirected to sign in page
37 37  
38 38 Scenario: I unsuccessfully change my password
39   - Given I visit profile account page
  39 + Given I visit profile password page
40 40 When I unsuccessfully change my password
41 41 Then I should see a password error message
42 42  
... ...
features/steps/profile/profile.rb
... ... @@ -133,8 +133,12 @@ class Profile &lt; Spinach::FeatureSteps
133 133 current_path.should == new_user_session_path
134 134 end
135 135  
  136 + step 'I should be redirected to password page' do
  137 + current_path.should == edit_profile_password_path
  138 + end
  139 +
136 140 step 'I should be redirected to account page' do
137   - current_path.should == account_profile_path
  141 + current_path.should == profile_account_path
138 142 end
139 143  
140 144 step 'I click on my profile picture' do
... ...
features/steps/shared/paths.rb
... ... @@ -65,8 +65,12 @@ module SharedPaths
65 65 visit profile_path
66 66 end
67 67  
  68 + step 'I visit profile password page' do
  69 + visit edit_profile_password_path
  70 + end
  71 +
68 72 step 'I visit profile account page' do
69   - visit account_profile_path
  73 + visit profile_account_path
70 74 end
71 75  
72 76 step 'I visit profile SSH keys page' do
... ...