Methods
T
Instance Public methods
test_compress_values()
# File activesupport/test/caching_test.rb, line 843
def test_compress_values
  entry = ActiveSupport::Cache::Entry.new("value", :compress => true, :compress_threshold => 1)
  assert_equal "value", entry.value
  assert entry.compressed?
  assert_equal "value", Marshal.load(Zlib::Inflate.inflate(entry.raw_value))
end
test_create_raw_entry()
# File activesupport/test/caching_test.rb, line 824
def test_create_raw_entry
  time = Time.now
  entry = ActiveSupport::Cache::Entry.create("raw", time, :compress => false, :expires_in => 300)
  assert_equal "raw", entry.raw_value
  assert_equal time.to_f, entry.created_at
  assert !entry.compressed?
  assert_equal 300, entry.expires_in
end
test_expired()
# File activesupport/test/caching_test.rb, line 833
def test_expired
  entry = ActiveSupport::Cache::Entry.new("value")
  assert !entry.expired?, 'entry not expired'
  entry = ActiveSupport::Cache::Entry.new("value", :expires_in => 60)
  assert !entry.expired?, 'entry not expired'
  time = Time.now + 61
  Time.stubs(:now).returns(time)
  assert entry.expired?, 'entry is expired'
end
test_non_compress_values()
# File activesupport/test/caching_test.rb, line 850
def test_non_compress_values
  entry = ActiveSupport::Cache::Entry.new("value")
  assert_equal "value", entry.value
  assert_equal "value", Marshal.load(entry.raw_value)
  assert !entry.compressed?
end