Permalink
Browse files

cache entry: options[:compressed] is a regular flag, no need for !!

  • Loading branch information...
1 parent 91678a5 commit f3554777b2433d9de6b17c277fde071592d6a10d @fxn fxn committed Nov 21, 2011
Showing with 4 additions and 4 deletions.
  1. +1 −1 activesupport/lib/active_support/cache.rb
  2. +3 −3 activesupport/test/caching_test.rb
@@ -542,7 +542,7 @@ def create(raw_value, created_at, options = {})
entry = new(nil)
entry.instance_variable_set(:@value, raw_value)
entry.instance_variable_set(:@created_at, created_at.to_f)
- entry.instance_variable_set(:@compressed, !!options[:compressed])
+ entry.instance_variable_set(:@compressed, options[:compressed])
entry.instance_variable_set(:@expires_in, options[:expires_in])
entry
end
@@ -723,7 +723,7 @@ def test_create_raw_entry
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_equal false, entry.compressed?
+ assert !entry.compressed?
assert_equal 300, entry.expires_in
end
@@ -740,14 +740,14 @@ def test_expired
def test_compress_values
entry = ActiveSupport::Cache::Entry.new("value", :compress => true, :compress_threshold => 1)
assert_equal "value", entry.value
- assert_equal true, entry.compressed?
+ assert entry.compressed?
assert_equal "value", Marshal.load(Zlib::Inflate.inflate(entry.raw_value))
end
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_equal false, entry.compressed?
+ assert !entry.compressed?
end
end

0 comments on commit f355477

Please sign in to comment.