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..78a4b34d --- /dev/null +++ b/spec/configuration_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require_relative "spec_helper" + +describe Rack::Attack::Configuration do + subject { Rack::Attack::Configuration.new } + + describe 'attributes' do + it 'exposes the safelists attribute' do + _(subject.safelists).must_equal({}) + end + + it 'exposes the blocklists attribute' do + _(subject.blocklists).must_equal({}) + end + + it 'exposes the throttles attribute' do + _(subject.throttles).must_equal({}) + end + + it 'exposes the tracks attribute' do + _(subject.tracks).must_equal({}) + end + + it 'exposes the anonymous_blocklists attribute' do + _(subject.anonymous_blocklists).must_equal([]) + end + + it 'exposes the anonymous_safelists attribute' do + _(subject.anonymous_safelists).must_equal([]) + end + end +end