Sha256: c23aaba2c5c1c6fe83baba4b5b46c8e1af0f54fae173117460d73dcce7d8b2b9

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

describe 'adapter_activesupportcache', adapter: :ActiveSupportCache do
  before :all do
    require 'active_support'
    require 'active_support/cache/moneta_store'
  end

  shared_examples :adapter_activesupportcache do
    moneta_build do
      Moneta::Adapters::ActiveSupportCache.new(backend: backend)
    end

    moneta_specs ADAPTER_SPECS.without_concurrent.without_create.with_native_expires
  end

  context 'using MemoryStore' do
    let(:t_res) { 0.125 }
    let(:min_ttl) { t_res }
    use_timecop

    let(:backend) { ActiveSupport::Cache::MemoryStore.new }
    include_examples :adapter_activesupportcache
  end

  context 'using MemCacheStore' do
    let(:t_res) { 1 }
    let(:min_ttl) { 2 }
    use_timecop
    start_memcached 11215

    let(:backend) { ActiveSupport::Cache::MemCacheStore.new('127.0.0.1:11215') }
    include_examples :adapter_activesupportcache
  end

  context 'using RedisCacheStore' do
    let(:t_res) { 1 }
    let(:min_ttl) { t_res }
    use_timecop

    let(:backend) { ActiveSupport::Cache::RedisCacheStore.new(url: 'redis:///1') }
    include_examples :adapter_activesupportcache
  end

  context 'using MonetaStore' do
    let(:t_res) { 0.125 }
    let(:min_ttl) { t_res }
    use_timecop

    let(:backend) { ActiveSupport::Cache::MonetaStore.new(store: Moneta.new(:Memory)) }
    include_examples :adapter_activesupportcache
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
moneta-1.1.1 spec/moneta/adapters/activesupportcache/adapter_activesupportcache_spec.rb
moneta-1.1.0 spec/moneta/adapters/activesupportcache/adapter_activesupportcache_spec.rb