Sha256: c88d08d47c2165242fd6d28af1762428116b6ede82f0b9b2dce5ab12c3701ef2
Contents?: true
Size: 1.04 KB
Versions: 11
Compression:
Stored size: 1.04 KB
Contents
RSpec.describe Rack::Tracker::Handler do def env { misc: 'foobar' } end describe '#tracker_options' do context 'without overriding allowed_tracker_options' do subject { described_class.new(env, { some_option: 'value' }) } it 'returns an empty hash' do expect(subject.tracker_options).to eql ({}) end end context 'with overridden allowed_tracker_options' do subject do handler = described_class.new(env, { static_option: 'value', dynamic_option: lambda { |env| return env[:misc] }, dynamic_nil_option: lambda { |env| return env[:non_existent_key] }, non_allowed_option: 'value' }) handler.allowed_tracker_options = [:static_option, :dynamic_option, :dynamic_nil_option] handler end it 'evaluates dynamic options, rejecting nonallowed and nil ones' do expect(subject.tracker_options).to eql ({ static_option: 'value', dynamic_option: 'foobar' }) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems