1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Add tests to previous commit.

This commit is contained in:
José Valim 2011-04-21 13:56:10 +02:00
parent fdfe6a8340
commit 40153b7422
3 changed files with 10 additions and 4 deletions

View file

@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
devise (1.3.1) devise (1.4.0.dev)
bcrypt-ruby (~> 2.1.2) bcrypt-ruby (~> 2.1.2)
orm_adapter (~> 0.0.3) orm_adapter (~> 0.0.3)
warden (~> 1.0.3) warden (~> 1.0.3)

View file

@ -61,8 +61,7 @@ module Devise
# #
def reset_password_period_valid? def reset_password_period_valid?
return true unless respond_to?(:reset_password_sent_at) return true unless respond_to?(:reset_password_sent_at)
reset_password_sent_at && reset_password_sent_at && reset_password_sent_at.utc >= self.class.reset_password_within.ago
reset_password_sent_at.utc >= self.class.reset_password_within.ago
end end
protected protected

View file

@ -204,4 +204,11 @@ class RecoverableTest < ActiveSupport::TestCase
user.reload user.reload
assert_not_nil user.reset_password_token assert_not_nil user.reset_password_token
end end
test 'should have valid period if does not respond to reset_password_sent_at' do
user = create_user
user.stubs(:respond_to?).with(:reset_password_sent_at).returns(false)
assert user.reset_password_period_valid?
end
end end