diff --git a/spec/acceptance/stores/active_support_mem_cache_store_pooled_spec.rb b/spec/acceptance/stores/active_support_mem_cache_store_pooled_spec.rb deleted file mode 100644 index 046919a7..00000000 --- a/spec/acceptance/stores/active_support_mem_cache_store_pooled_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../spec_helper" - -if defined?(::ConnectionPool) && defined?(::Dalli) - require_relative "../../support/cache_store_helper" - - describe "ActiveSupport::Cache::MemCacheStore (pooled) as a cache backend" do - before do - Rack::Attack.cache.store = if ActiveSupport.gem_version >= Gem::Version.new("7.2.0") - ActiveSupport::Cache::MemCacheStore.new(pool: true) - else - ActiveSupport::Cache::MemCacheStore.new(pool_size: 2) - end - end - - after do - Rack::Attack.cache.store.clear - end - - it_works_for_cache_backed_features(fetch_from_store: ->(key) { Rack::Attack.cache.store.read(key) }) - end -end diff --git a/spec/acceptance/stores/active_support_mem_cache_store_spec.rb b/spec/acceptance/stores/active_support_mem_cache_store_spec.rb index 09f63517..ccfe3db7 100644 --- a/spec/acceptance/stores/active_support_mem_cache_store_spec.rb +++ b/spec/acceptance/stores/active_support_mem_cache_store_spec.rb @@ -7,7 +7,11 @@ describe "ActiveSupport::Cache::MemCacheStore as a cache backend" do before do - Rack::Attack.cache.store = ActiveSupport::Cache::MemCacheStore.new + Rack::Attack.cache.store = if ActiveSupport.gem_version >= Gem::Version.new("7.2.0") + ActiveSupport::Cache::MemCacheStore.new(pool: true) + else + ActiveSupport::Cache::MemCacheStore.new(pool_size: 2) + end end after do diff --git a/spec/acceptance/stores/active_support_redis_cache_store_pooled_spec.rb b/spec/acceptance/stores/active_support_redis_cache_store_pooled_spec.rb deleted file mode 100644 index 29947381..00000000 --- a/spec/acceptance/stores/active_support_redis_cache_store_pooled_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../spec_helper" - -should_run = - defined?(::ConnectionPool) && - defined?(::Redis) && - Gem::Version.new(::Redis::VERSION) >= Gem::Version.new("4") && - defined?(::ActiveSupport::Cache::RedisCacheStore) - -if should_run - require_relative "../../support/cache_store_helper" - - describe "ActiveSupport::Cache::RedisCacheStore (pooled) as a cache backend" do - before do - Rack::Attack.cache.store = if ActiveSupport.gem_version >= Gem::Version.new("7.2.0") - ActiveSupport::Cache::RedisCacheStore.new(pool: true) - else - ActiveSupport::Cache::RedisCacheStore.new(pool_size: 2) - end - end - - after do - Rack::Attack.cache.store.clear - end - - it_works_for_cache_backed_features(fetch_from_store: ->(key) { Rack::Attack.cache.store.read(key) }) - end -end diff --git a/spec/acceptance/stores/active_support_redis_cache_store_spec.rb b/spec/acceptance/stores/active_support_redis_cache_store_spec.rb index 99701a3e..9cf1636e 100644 --- a/spec/acceptance/stores/active_support_redis_cache_store_spec.rb +++ b/spec/acceptance/stores/active_support_redis_cache_store_spec.rb @@ -12,7 +12,11 @@ describe "ActiveSupport::Cache::RedisCacheStore as a cache backend" do before do - Rack::Attack.cache.store = ActiveSupport::Cache::RedisCacheStore.new + Rack::Attack.cache.store = if ActiveSupport.gem_version >= Gem::Version.new("7.2.0") + ActiveSupport::Cache::RedisCacheStore.new(pool: true) + else + ActiveSupport::Cache::RedisCacheStore.new(pool_size: 2) + end end after do diff --git a/spec/acceptance/stores/connection_pool_dalli_client_spec.rb b/spec/acceptance/stores/connection_pool_dalli_client_spec.rb deleted file mode 100644 index 9658480d..00000000 --- a/spec/acceptance/stores/connection_pool_dalli_client_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../spec_helper" - -if defined?(::Dalli) && defined?(::ConnectionPool) - require_relative "../../support/cache_store_helper" - require "connection_pool" - require "dalli" - - describe "ConnectionPool with Dalli::Client as a cache backend" do - before do - Rack::Attack.cache.store = ConnectionPool.new { Dalli::Client.new } - end - - after do - Rack::Attack.cache.store.with { |client| client.flush_all } - end - - it_works_for_cache_backed_features( - fetch_from_store: ->(key) { Rack::Attack.cache.store.with { |client| client.fetch(key) } } - ) - end -end diff --git a/spec/acceptance/stores/dalli_client_spec.rb b/spec/acceptance/stores/dalli_client_spec.rb index f6841e4a..2b273740 100644 --- a/spec/acceptance/stores/dalli_client_spec.rb +++ b/spec/acceptance/stores/dalli_client_spec.rb @@ -17,4 +17,18 @@ it_works_for_cache_backed_features(fetch_from_store: ->(key) { Rack::Attack.cache.store.fetch(key) }) end + + describe "ConnectionPool with Dalli::Client as a cache backend" do + before do + Rack::Attack.cache.store = ConnectionPool.new { Dalli::Client.new } + end + + after do + Rack::Attack.cache.store.with { |client| client.flush_all } + end + + it_works_for_cache_backed_features( + fetch_from_store: ->(key) { Rack::Attack.cache.store.with { |client| client.fetch(key) } } + ) + end end