Commit 43810b27c9fb16d9b411f99ea1fb80e4c337c199

Authored by AntonioTerceiro
1 parent 19443585

ActionItem78: testing != cancel instead of == finished



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@691 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/change_password.rb
... ... @@ -45,9 +45,9 @@ class ChangePassword < Task
45 45 # validations for updating a ChangePassword task
46 46  
47 47 # only require the new password when actually changing it.
48   - validates_presence_of :password, :on => :update, :if => lambda { |change| change.status == Task::Status::FINISHED }
49   - validates_presence_of :password_confirmation, :on => :update, :if => lambda { |change| change.status == Task::Status::FINISHED }
50   - validates_confirmation_of :password, :if => lambda { |change| change.status == Task::Status::FINISHED }
  48 + validates_presence_of :password, :on => :update, :if => lambda { |change| change.status != Task::Status::CANCELLED }
  49 + validates_presence_of :password_confirmation, :on => :update, :if => lambda { |change| change.status != Task::Status::CANCELLED }
  50 + validates_confirmation_of :password, :if => lambda { |change| change.status != Task::Status::CANCELLED }
51 51  
52 52 def initialize(*args)
53 53 super(*args)
... ...
test/unit/change_password_test.rb
... ... @@ -87,6 +87,8 @@ class ChangePasswordTest < Test::Unit::TestCase
87 87 change.password = 'newpass'
88 88 change.password_confirmation = 'newpass'
89 89 change.finish
  90 +
  91 + assert User.find(person.user.id).authenticated?('newpass')
90 92 end
91 93  
92 94 should 'not require password and password confirmation when cancelling' do
... ... @@ -101,7 +103,6 @@ class ChangePasswordTest < Test::Unit::TestCase
101 103 assert_nothing_raised do
102 104 change.cancel
103 105 end
104   -
105 106 end
106 107  
107 108  
... ...