Skip to content

Commit

Permalink
Add tracks attr_reader to Configuration (#664)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsmartens authored Jun 24, 2024
1 parent 0fbc9a1 commit 427fdfa
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rack/attack/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 33 additions & 0 deletions spec/configuration_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 427fdfa

Please sign in to comment.