Moved require from application.js to password_strength.js
Corrected div id for profile password/edit Added first spinach tests
This commit is contained in:
parent
7fbc4f5b3a
commit
000af8d5d7
5 changed files with 55 additions and 2 deletions
|
@ -18,7 +18,6 @@
|
|||
#= require jquery.turbolinks
|
||||
#= require turbolinks
|
||||
#= require bootstrap
|
||||
#= require pwstrength-bootstrap-1.2.2
|
||||
#= require password_strength
|
||||
#= require select2
|
||||
#= require raphael
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#= require pwstrength-bootstrap-1.2.2
|
||||
overwritten_messages =
|
||||
wordSimilarToUsername: "Your password should not contain your username"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
%div
|
||||
= link_to "Forgot your password?", reset_profile_password_path, method: :put
|
||||
|
||||
.form-group#password-strength
|
||||
.form-group
|
||||
= f.label :password, 'New password', class: 'control-label'
|
||||
.col-sm-10
|
||||
= f.password_field :password, required: true, class: 'form-control', id: 'user_password_profile'
|
||||
|
|
|
@ -83,3 +83,22 @@ Feature: Profile
|
|||
Given I visit profile design page
|
||||
When I change my code preview theme
|
||||
Then I should receive feedback that the changes were saved
|
||||
|
||||
@javascript
|
||||
Scenario: I see the password strength indicator
|
||||
Given I visit profile password page
|
||||
When I try to set a weak password
|
||||
Then I should see the input field yellow
|
||||
|
||||
@javascript
|
||||
Scenario: I see the password strength indicator error
|
||||
Given I visit profile password page
|
||||
When I try to set a short password
|
||||
Then I should see the input field red
|
||||
And I should see the password error message
|
||||
|
||||
@javascript
|
||||
Scenario: I see the password strength indicator with success
|
||||
Given I visit profile password page
|
||||
When I try to set a strong password
|
||||
Then I should see the input field green
|
|
@ -64,6 +64,24 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
|
|||
end
|
||||
end
|
||||
|
||||
step 'I try to set a weak password' do
|
||||
within '.update-password' do
|
||||
fill_in "user_password_profile", with: "22233344"
|
||||
end
|
||||
end
|
||||
|
||||
step 'I try to set a short password' do
|
||||
within '.update-password' do
|
||||
fill_in "user_password_profile", with: "short"
|
||||
end
|
||||
end
|
||||
|
||||
step 'I try to set a strong password' do
|
||||
within '.update-password' do
|
||||
fill_in "user_password_profile", with: "Itulvo9z8uud%$"
|
||||
end
|
||||
end
|
||||
|
||||
step 'I change my password' do
|
||||
within '.update-password' do
|
||||
fill_in "user_current_password", with: "12345678"
|
||||
|
@ -86,6 +104,22 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
|
|||
page.should have_content "You must provide a valid current password"
|
||||
end
|
||||
|
||||
step 'I should see the input field yellow' do
|
||||
page.should have_css 'div.has-warning'
|
||||
end
|
||||
|
||||
step 'I should see the input field green' do
|
||||
page.should have_css 'div.has-success'
|
||||
end
|
||||
|
||||
step 'I should see the input field red' do
|
||||
page.should have_css 'div.has-error'
|
||||
end
|
||||
|
||||
step 'I should see the password error message' do
|
||||
page.should have_content 'Your password is too short'
|
||||
end
|
||||
|
||||
step "I should see a password error message" do
|
||||
page.should have_content "Password confirmation doesn't match"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue