diff options
Diffstat (limited to 'activesupport/test/cache/cache_entry_test.rb')
-rw-r--r-- | activesupport/test/cache/cache_entry_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activesupport/test/cache/cache_entry_test.rb b/activesupport/test/cache/cache_entry_test.rb new file mode 100644 index 0000000000..ec20a288e1 --- /dev/null +++ b/activesupport/test/cache/cache_entry_test.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require "abstract_unit" +require "active_support/cache" + +class CacheEntryTest < ActiveSupport::TestCase + def test_expired + entry = ActiveSupport::Cache::Entry.new("value") + assert_not entry.expired?, "entry not expired" + entry = ActiveSupport::Cache::Entry.new("value", expires_in: 60) + assert_not entry.expired?, "entry not expired" + Time.stub(:now, Time.now + 61) do + assert entry.expired?, "entry is expired" + end + end +end |