diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4047aeab..7afda9ae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,7 +40,6 @@ jobs: - active_support_redis_cache_store - active_support_redis_cache_store_pooled - redis_store - - active_support_redis_store exclude: - gemfile: rack_1 ruby: 3.2.2 diff --git a/Appraisals b/Appraisals index 2d270527..4f222a0f 100644 --- a/Appraisals +++ b/Appraisals @@ -80,8 +80,3 @@ end appraise "redis_store" do gem "redis-store", "~> 1.5" end - -appraise "active_support_redis_store" do - gem "redis-activesupport", "~> 5.0" - gem 'redis-store', '1.9.1' # remove after https://github.com/redis-store/redis-store/issues/358 is resolved -end diff --git a/gemfiles/active_support_redis_store.gemfile b/gemfiles/active_support_redis_store.gemfile deleted file mode 100644 index b3567fa3..00000000 --- a/gemfiles/active_support_redis_store.gemfile +++ /dev/null @@ -1,8 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "redis-activesupport", "~> 5.0" -gem "redis-store", "1.9.1" - -gemspec path: "../" diff --git a/lib/rack/attack.rb b/lib/rack/attack.rb index 9b134165..b3488ba2 100644 --- a/lib/rack/attack.rb +++ b/lib/rack/attack.rb @@ -11,7 +11,6 @@ require 'rack/attack/store_proxy/redis_proxy' require 'rack/attack/store_proxy/redis_store_proxy' require 'rack/attack/store_proxy/redis_cache_store_proxy' -require 'rack/attack/store_proxy/active_support_redis_store_proxy' require 'rack/attack/railtie' if defined?(::Rails) diff --git a/lib/rack/attack/store_proxy/active_support_redis_store_proxy.rb b/lib/rack/attack/store_proxy/active_support_redis_store_proxy.rb deleted file mode 100644 index d2c0e3b2..00000000 --- a/lib/rack/attack/store_proxy/active_support_redis_store_proxy.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -require 'rack/attack/base_proxy' - -module Rack - class Attack - module StoreProxy - class ActiveSupportRedisStoreProxy < BaseProxy - def self.handle?(store) - defined?(::Redis) && - defined?(::ActiveSupport::Cache::RedisStore) && - store.is_a?(::ActiveSupport::Cache::RedisStore) - end - - def increment(name, amount = 1, options = {}) - # #increment ignores options[:expires_in]. - # - # So in order to workaround this we use #write (which sets expiration) to initialize - # the counter. After that we continue using the original #increment. - if options[:expires_in] && !read(name) - write(name, amount, options) - - amount - else - super - end - end - - def read(name, options = {}) - super(name, options.merge!(raw: true)) - end - - def write(name, value, options = {}) - super(name, value, options.merge!(raw: true)) - end - end - end - end -end diff --git a/spec/acceptance/stores/active_support_redis_store_spec.rb b/spec/acceptance/stores/active_support_redis_store_spec.rb deleted file mode 100644 index 75e4d68d..00000000 --- a/spec/acceptance/stores/active_support_redis_store_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../spec_helper" - -if defined?(::ActiveSupport::Cache::RedisStore) - require_relative "../../support/cache_store_helper" - require "timecop" - - describe "ActiveSupport::Cache::RedisStore as a cache backend" do - before do - Rack::Attack.cache.store = ActiveSupport::Cache::RedisStore.new - 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/redis_store_spec.rb b/spec/acceptance/stores/redis_store_spec.rb index d7e8e115..dee35bcf 100644 --- a/spec/acceptance/stores/redis_store_spec.rb +++ b/spec/acceptance/stores/redis_store_spec.rb @@ -6,7 +6,7 @@ if defined?(::Redis::Store) require "timecop" - describe "ActiveSupport::Cache::RedisStore as a cache backend" do + describe "Redis::Store as a cache backend" do before do Rack::Attack.cache.store = ::Redis::Store.new end diff --git a/spec/integration/offline_spec.rb b/spec/integration/offline_spec.rb index d4960633..85429a42 100644 --- a/spec/integration/offline_spec.rb +++ b/spec/integration/offline_spec.rb @@ -21,18 +21,6 @@ end end -if defined?(::ActiveSupport::Cache::RedisStore) - describe 'when Redis is offline' do - include OfflineExamples - - before do - @cache = Rack::Attack::Cache.new - # Use presumably unused port for Redis client - @cache.store = ActiveSupport::Cache::RedisStore.new(host: '127.0.0.1', port: 3333) - end - end -end - if defined?(Redis) && defined?(ActiveSupport::Cache::RedisCacheStore) && Redis::VERSION >= '4' describe 'when Redis is offline' do include OfflineExamples diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5cd8d888..f529e6a1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -21,7 +21,6 @@ def safe_require(name) safe_require "connection_pool" safe_require "dalli" safe_require "redis" -safe_require "redis-activesupport" safe_require "redis-store" class Minitest::Spec