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:
parent
fdfe6a8340
commit
40153b7422
3 changed files with 10 additions and 4 deletions
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue