2017-07-09 08:06:36 -04:00
|
|
|
# frozen_string_literal: true
|
2017-07-10 09:39:13 -04:00
|
|
|
|
2017-06-10 04:07:40 -04:00
|
|
|
require "abstract_unit"
|
|
|
|
require "active_support/cache"
|
|
|
|
|
|
|
|
class CacheEntryTest < ActiveSupport::TestCase
|
|
|
|
def test_expired
|
|
|
|
entry = ActiveSupport::Cache::Entry.new("value")
|
2018-05-12 22:26:10 -04:00
|
|
|
assert_not entry.expired?, "entry not expired"
|
2017-06-10 04:07:40 -04:00
|
|
|
entry = ActiveSupport::Cache::Entry.new("value", expires_in: 60)
|
2018-05-12 22:26:10 -04:00
|
|
|
assert_not entry.expired?, "entry not expired"
|
2017-06-10 04:07:40 -04:00
|
|
|
Time.stub(:now, Time.now + 61) do
|
|
|
|
assert entry.expired?, "entry is expired"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|