From: Tomas Sedovic tsedovic@redhat.com
https://bugzilla.redhat.com/show_bug.cgi?id=642165
Steps: (on the user edit page) 1. Leave the "Change Password" field blank 2. Fill in the "Confirm Password" field with some text 3. Press Save
The test is currently failing. --- src/features/step_definitions/user_steps.rb | 3 +++ src/features/user.feature | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 0 deletions(-) create mode 100644 src/features/step_definitions/user_steps.rb create mode 100644 src/features/user.feature
diff --git a/src/features/step_definitions/user_steps.rb b/src/features/step_definitions/user_steps.rb new file mode 100644 index 0000000..09bbaf8 --- /dev/null +++ b/src/features/step_definitions/user_steps.rb @@ -0,0 +1,3 @@ +Given /^there is a user "([^"]*)"$/ do |name| + @user = User.find_by_login(name) +end diff --git a/src/features/user.feature b/src/features/user.feature new file mode 100644 index 0000000..e11dfba --- /dev/null +++ b/src/features/user.feature @@ -0,0 +1,27 @@ +Feature: Manage Users + In order to manage users + As an admin + I want to add/edit/remove users + + Background: + Given I am an authorised user + And I am logged in + And a user "testuser" exists + + Scenario: Change the password + Given I am on the users page + And there is a user "testuser" + When I follow "testuser" + Then I should see "Editing User:" + When I fill in "user[password]" with "new password" + And I fill in "user[password_confirmation]" with "" + And I press "Save" + Then I should see "Password doesn't match confirmation" + When I fill in "user[password]" with "" + And I fill in "user[password_confirmation]" with "new password" + And I press "Save" + Then I should see "Password doesn't match confirmation" + When I fill in "user[password]" with "new password" + And I fill in "user[password_confirmation]" with "new password" + And I press "Save" + Then I should see "User updated!"
From: Tomas Sedovic tsedovic@redhat.com
Updating a user's password now fails when only one of the password/confirmation fields is filled in. --- src/app/models/user.rb | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/app/models/user.rb b/src/app/models/user.rb index fe429bd..aff5f98 100644 --- a/src/app/models/user.rb +++ b/src/app/models/user.rb @@ -27,4 +27,9 @@ class User < ActiveRecord::Base
belongs_to :quota, :autosave => true accepts_nested_attributes_for :quota + + # authlogic's password confirmation doesn't fire up when we fill in the + # confirmation field but leave the password field blank. We have to check + # that manually: + validates_confirmation_of :password, :if => "password.blank? and !password_confirmation.blank?" end
On 11/03/2010 04:12 PM, tsedovic@redhat.com wrote:
From: Tomas Sedovictsedovic@redhat.com
https://bugzilla.redhat.com/show_bug.cgi?id=642165
Steps: (on the user edit page)
- Leave the "Change Password" field blank
- Fill in the "Confirm Password" field with some text
- Press Save
The test is currently failing.
src/features/step_definitions/user_steps.rb | 3 +++ src/features/user.feature | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 0 deletions(-) create mode 100644 src/features/step_definitions/user_steps.rb create mode 100644 src/features/user.feature
diff --git a/src/features/step_definitions/user_steps.rb b/src/features/step_definitions/user_steps.rb new file mode 100644 index 0000000..09bbaf8 --- /dev/null +++ b/src/features/step_definitions/user_steps.rb @@ -0,0 +1,3 @@ +Given /^there is a user "([^"]*)"$/ do |name|
- @user = User.find_by_login(name)
+end diff --git a/src/features/user.feature b/src/features/user.feature new file mode 100644 index 0000000..e11dfba --- /dev/null +++ b/src/features/user.feature @@ -0,0 +1,27 @@ +Feature: Manage Users
- In order to manage users
- As an admin
- I want to add/edit/remove users
- Background:
- Given I am an authorised user
- And I am logged in
- And a user "testuser" exists
- Scenario: Change the password
- Given I am on the users page
- And there is a user "testuser"
- When I follow "testuser"
- Then I should see "Editing User:"
- When I fill in "user[password]" with "new password"
- And I fill in "user[password_confirmation]" with ""
- And I press "Save"
- Then I should see "Password doesn't match confirmation"
- When I fill in "user[password]" with ""
- And I fill in "user[password_confirmation]" with "new password"
- And I press "Save"
- Then I should see "Password doesn't match confirmation"
- When I fill in "user[password]" with "new password"
- And I fill in "user[password_confirmation]" with "new password"
- And I press "Save"
- Then I should see "User updated!"
ACK to both
deltacloud-devel@lists.fedorahosted.org