diff --git a/lib/rack/attack/configuration.rb b/lib/rack/attack/configuration.rb index a4bdc987..81f81915 100644 --- a/lib/rack/attack/configuration.rb +++ b/lib/rack/attack/configuration.rb @@ -19,7 +19,7 @@ class Configuration end end - attr_reader :safelists, :blocklists, :throttles, :anonymous_blocklists, :anonymous_safelists + attr_reader :safelists, :blocklists, :throttles, :tracks, :anonymous_blocklists, :anonymous_safelists attr_accessor :blocklisted_responder, :throttled_responder, :throttled_response_retry_after_header attr_reader :blocklisted_response, :throttled_response # Keeping these for backwards compatibility diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb new file mode 100644 index 00000000..212254a8 --- /dev/null +++ b/spec/configuration_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require_relative "spec_helper" + +describe Rack::Attack::Configuration do + let(:config) { Rack::Attack::Configuration.new } + + describe 'attributes' do + it 'exposes the safelists attribute' do + expect(config.safelists).to eq({}) + end + + it 'exposes the blocklists attribute' do + expect(config.blocklists).to eq({}) + end + + it 'exposes the throttles attribute' do + expect(config.throttles).to eq({}) + end + + it 'exposes the tracks attribute' do + expect(config.tracks).to eq({}) + end + + it 'exposes the anonymous_blocklists attribute' do + expect(config.anonymous_blocklists).to eq([]) + end + + it 'exposes the anonymous_safelists attribute' do + expect(config.anonymous_safelists).to eq([]) + end + end +end