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
remote: .
specs:
devise (1.3.1)
devise (1.4.0.dev)
bcrypt-ruby (~> 2.1.2)
orm_adapter (~> 0.0.3)
warden (~> 1.0.3)

View file

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

View file

@ -204,4 +204,11 @@ class RecoverableTest < ActiveSupport::TestCase
user.reload
assert_not_nil user.reset_password_token
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