1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activesupport/test/cache/cache_entry_test.rb
Michael Grosser 203998c916
allow running each test with pure ruby path/to/test.rb
also:
 - makes test dependencies obvious
 - makes tests runnable from within subfolders
2019-12-18 08:49:19 -06:00

16 lines
493 B
Ruby

# frozen_string_literal: true
require_relative "../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