Add scenario for expired password
This commit is contained in:
parent
318b50a0b3
commit
6c0fd9f29a
2 changed files with 40 additions and 15 deletions
|
@ -16,6 +16,13 @@ Feature: Profile
|
||||||
Then I change my password
|
Then I change my password
|
||||||
And I should be redirected to sign in page
|
And I should be redirected to sign in page
|
||||||
|
|
||||||
|
Scenario: My password is expired
|
||||||
|
Given my password is expired
|
||||||
|
And I visit profile account page
|
||||||
|
Then I redirected to expired password page
|
||||||
|
And I submit new password
|
||||||
|
And I redirected to sign in page
|
||||||
|
|
||||||
Scenario: I unsuccessfully change my password
|
Scenario: I unsuccessfully change my password
|
||||||
Given I visit profile account page
|
Given I visit profile account page
|
||||||
When I unsuccessfully change my password
|
When I unsuccessfully change my password
|
||||||
|
|
|
@ -2,13 +2,13 @@ class Profile < Spinach::FeatureSteps
|
||||||
include SharedAuthentication
|
include SharedAuthentication
|
||||||
include SharedPaths
|
include SharedPaths
|
||||||
|
|
||||||
Then 'I should see my profile info' do
|
step 'I should see my profile info' do
|
||||||
page.should have_content "Profile"
|
page.should have_content "Profile"
|
||||||
page.should have_content @user.name
|
page.should have_content @user.name
|
||||||
page.should have_content @user.email
|
page.should have_content @user.email
|
||||||
end
|
end
|
||||||
|
|
||||||
Then 'I change my contact info' do
|
step 'I change my contact info' do
|
||||||
fill_in "user_skype", with: "testskype"
|
fill_in "user_skype", with: "testskype"
|
||||||
fill_in "user_linkedin", with: "testlinkedin"
|
fill_in "user_linkedin", with: "testlinkedin"
|
||||||
fill_in "user_twitter", with: "testtwitter"
|
fill_in "user_twitter", with: "testtwitter"
|
||||||
|
@ -16,13 +16,13 @@ class Profile < Spinach::FeatureSteps
|
||||||
@user.reload
|
@user.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
And 'I should see new contact info' do
|
step 'I should see new contact info' do
|
||||||
@user.skype.should == 'testskype'
|
@user.skype.should == 'testskype'
|
||||||
@user.linkedin.should == 'testlinkedin'
|
@user.linkedin.should == 'testlinkedin'
|
||||||
@user.twitter.should == 'testtwitter'
|
@user.twitter.should == 'testtwitter'
|
||||||
end
|
end
|
||||||
|
|
||||||
Then 'I change my password' do
|
step 'I change my password' do
|
||||||
within '.update-password' do
|
within '.update-password' do
|
||||||
fill_in "user_password", with: "222333"
|
fill_in "user_password", with: "222333"
|
||||||
fill_in "user_password_confirmation", with: "222333"
|
fill_in "user_password_confirmation", with: "222333"
|
||||||
|
@ -30,7 +30,7 @@ class Profile < Spinach::FeatureSteps
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
When 'I unsuccessfully change my password' do
|
step 'I unsuccessfully change my password' do
|
||||||
within '.update-password' do
|
within '.update-password' do
|
||||||
fill_in "user_password", with: "password"
|
fill_in "user_password", with: "password"
|
||||||
fill_in "user_password_confirmation", with: "confirmation"
|
fill_in "user_password_confirmation", with: "confirmation"
|
||||||
|
@ -38,52 +38,70 @@ class Profile < Spinach::FeatureSteps
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Then "I should see a password error message" do
|
step "I should see a password error message" do
|
||||||
page.should have_content "Password doesn't match confirmation"
|
page.should have_content "Password doesn't match confirmation"
|
||||||
end
|
end
|
||||||
|
|
||||||
And 'I should be redirected to sign in page' do
|
step 'I should be redirected to sign in page' do
|
||||||
current_path.should == new_user_session_path
|
current_path.should == new_user_session_path
|
||||||
end
|
end
|
||||||
|
|
||||||
Then 'I reset my token' do
|
step 'I reset my token' do
|
||||||
within '.update-token' do
|
within '.update-token' do
|
||||||
@old_token = @user.private_token
|
@old_token = @user.private_token
|
||||||
click_button "Reset"
|
click_button "Reset"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
And 'I should see new token' do
|
step 'I should see new token' do
|
||||||
find("#token").value.should_not == @old_token
|
find("#token").value.should_not == @old_token
|
||||||
find("#token").value.should == @user.reload.private_token
|
find("#token").value.should == @user.reload.private_token
|
||||||
end
|
end
|
||||||
|
|
||||||
Given 'I have activity' do
|
step 'I have activity' do
|
||||||
create(:closed_issue_event, author: current_user)
|
create(:closed_issue_event, author: current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
Then 'I should see my activity' do
|
step 'I should see my activity' do
|
||||||
page.should have_content "#{current_user.name} closed issue"
|
page.should have_content "#{current_user.name} closed issue"
|
||||||
end
|
end
|
||||||
|
|
||||||
When "I change my application theme" do
|
step "I change my application theme" do
|
||||||
within '.application-theme' do
|
within '.application-theme' do
|
||||||
choose "Violet"
|
choose "Violet"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
When "I change my code preview theme" do
|
step "I change my code preview theme" do
|
||||||
within '.code-preview-theme' do
|
within '.code-preview-theme' do
|
||||||
choose "Solarized dark"
|
choose "Solarized dark"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Then "I should see the theme change immediately" do
|
step "I should see the theme change immediately" do
|
||||||
page.should have_selector('body.ui_color')
|
page.should have_selector('body.ui_color')
|
||||||
page.should_not have_selector('body.ui_basic')
|
page.should_not have_selector('body.ui_basic')
|
||||||
end
|
end
|
||||||
|
|
||||||
Then "I should receive feedback that the changes were saved" do
|
step "I should receive feedback that the changes were saved" do
|
||||||
page.should have_content("Saved")
|
page.should have_content("Saved")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
step 'my password is expired' do
|
||||||
|
current_user.update_attributes(password_expires_at: Time.now - 1.hour)
|
||||||
|
end
|
||||||
|
|
||||||
|
step 'I redirected to expired password page' do
|
||||||
|
current_path.should == new_profile_password_path
|
||||||
|
end
|
||||||
|
|
||||||
|
step 'I submit new password' do
|
||||||
|
fill_in :user_password, with: '12345678'
|
||||||
|
fill_in :user_password_confirmation, with: '12345678'
|
||||||
|
click_button "Set new password"
|
||||||
|
end
|
||||||
|
|
||||||
|
step 'I redirected to sign in page' do
|
||||||
|
current_path.should == new_user_session_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue