Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Add tracks attr_reader to Configuration #664

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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