Sha256: c75e8c550a08e3638d6367f7db10781970ca1b80bffa82d3293e40e4e02d6399

Contents?: true

Size: 1.57 KB

Versions: 5

Compression:

Stored size: 1.57 KB

Contents

require_relative '../memcached_helper'

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

  shared_examples :adapter_activesupportcache_with_default_expires do
    moneta_build do
      Moneta::Adapters::ActiveSupportCache.new(backend: backend, expires: min_ttl)
    end

    moneta_specs ADAPTER_SPECS.without_concurrent.without_create.with_native_expires.with_default_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_with_default_expires
  end

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

    include_context :start_memcached, 11223

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

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

    let(:backend) { ActiveSupport::Cache::RedisCacheStore.new(url: 'redis:///2') }
    include_examples :adapter_activesupportcache_with_default_expires
  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_with_default_expires
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
moneta-1.4.1 spec/moneta/adapters/activesupportcache/adapter_activesupportcache_with_default_expires_spec.rb
moneta-1.4.0 spec/moneta/adapters/activesupportcache/adapter_activesupportcache_with_default_expires_spec.rb
moneta-1.3.0 spec/moneta/adapters/activesupportcache/adapter_activesupportcache_with_default_expires_spec.rb
moneta-1.2.1 spec/moneta/adapters/activesupportcache/adapter_activesupportcache_with_default_expires_spec.rb
moneta-1.2.0 spec/moneta/adapters/activesupportcache/adapter_activesupportcache_with_default_expires_spec.rb