Sha256: 96c5c54f44765cbc124e26064caa54a1302a1b12f9b56a22e9db79ddcb262fb3

Contents?: true

Size: 682 Bytes

Versions: 5

Compression:

Stored size: 682 Bytes

Contents

require 'test_helper'
require 'redis-kit/cache'

describe RedisKit::Cache do
  before do
    RedisKit.redis = RedisKit.new_redis( good_config_path, "test_mock" )
  end

  after do
    RedisKit.redis.del "test:*"
  end

  it "caches values" do
    calculated = false
    value = RedisKit::Cache.get( "test:foo", 60 ) do
      calculated = true
      "yep"
    end
    value.must_equal "yep"
    calculated.must_equal true
    RedisKit.redis.ttl( "test:foo" ).must_equal 60

    # cache primed
    calculated = false
    value = RedisKit::Cache.get( "test:foo", 60 ) do
      calculated = true
      "yep"
    end
    value.must_equal "yep"
    calculated.must_equal false
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
redis-kit-0.1.0 test/redis-kit/cache_test.rb
redis-kit-0.0.6 test/redis-kit/cache_test.rb
redis-kit-0.0.5 test/redis-kit/cache_test.rb
redis-kit-0.0.4 test/redis-kit/cache_test.rb
redis-kit-0.0.3 test/redis-kit/cache_test.rb