Add tracks attr_reader to Configuration (#664)

This commit is contained in:
Alex Martens 2024-06-24 10:46:01 -07:00 committed by GitHub
parent 0fbc9a1c46
commit 427fdfabbc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 1 deletions

View file

@ -19,7 +19,7 @@ module Rack
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

View file

@ -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