Skip to content

Commit

Permalink
Add tracks attr_reader to Configuration
Browse files Browse the repository at this point in the history
Co-authored-by: Santiago Bartesaghi <santib@hey.com>
  • Loading branch information
alexsmartens and santib committed Jun 24, 2024
1 parent 0fbc9a1 commit 7dd2547
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
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

0 comments on commit 7dd2547

Please sign in to comment.