mirror of
https://github.com/meineerde/rackstash.git
synced 2025-10-17 14:01:01 +00:00
Initialize monitor and copy internal filters list on FilterChain#dup
This commit is contained in:
parent
6c145579ed
commit
271c547f05
@ -273,6 +273,15 @@ module Rackstash
|
||||
|
||||
private
|
||||
|
||||
def initialize_copy(orig)
|
||||
super
|
||||
|
||||
mon_initialize
|
||||
synchronize do
|
||||
@filters = orig.to_a
|
||||
end
|
||||
end
|
||||
|
||||
def index_at(index)
|
||||
case index
|
||||
when Integer, ->(o) { o.respond_to?(:to_int) }
|
||||
|
||||
@ -225,6 +225,16 @@ describe Rackstash::FilterChain do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#dup' do
|
||||
it 'duplicates the filters array' do
|
||||
filter_chain << a_filter
|
||||
dupped = filter_chain.dup
|
||||
|
||||
expect(filter_chain.length).to eql dupped.length
|
||||
expect { filter_chain << a_filter }.not_to change { dupped.length }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#each' do
|
||||
it 'yields each filter' do
|
||||
filter_chain << -> {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user