mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
do not test explicit equality of predicate methods, they should be allowed to return truthy or falsey objects
This commit is contained in:
parent
a032212e7c
commit
5968d7a658
2 changed files with 4 additions and 8 deletions
|
@ -590,11 +590,7 @@ module ActiveSupport
|
|||
# Check if the entry is expired. The +expires_in+ parameter can override the
|
||||
# value set when the entry was created.
|
||||
def expired?
|
||||
if @expires_in && @created_at + @expires_in <= Time.now.to_f
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
@expires_in && @created_at + @expires_in <= Time.now.to_f
|
||||
end
|
||||
|
||||
# Set a new time when the entry will expire.
|
||||
|
|
|
@ -679,12 +679,12 @@ class CacheEntryTest < ActiveSupport::TestCase
|
|||
|
||||
def test_expired
|
||||
entry = ActiveSupport::Cache::Entry.new("value")
|
||||
assert_equal false, entry.expired?
|
||||
assert !entry.expired?, 'entry not expired'
|
||||
entry = ActiveSupport::Cache::Entry.new("value", :expires_in => 60)
|
||||
assert_equal false, entry.expired?
|
||||
assert !entry.expired?, 'entry not expired'
|
||||
time = Time.now + 61
|
||||
Time.stubs(:now).returns(time)
|
||||
assert_equal true, entry.expired?
|
||||
assert entry.expired?, 'entry is expired'
|
||||
end
|
||||
|
||||
def test_compress_values
|
||||
|
|
Loading…
Reference in a new issue