mirror of
https://github.com/meineerde/rackstash.git
synced 2025-10-17 14:01:01 +00:00
Make Flow#unshift_filter the primary alias before filter_prepend to be more consistent
This commit is contained in:
parent
581b8b1819
commit
d362b7efaa
@ -166,11 +166,11 @@ module Rackstash
|
||||
end
|
||||
|
||||
# (see FilterChain#unshift)
|
||||
def filter_prepend(*filter, &block)
|
||||
def filter_unshift(*filter, &block)
|
||||
@filter_chain.unshift(*filter, &block)
|
||||
self
|
||||
end
|
||||
alias filter_unshift filter_prepend
|
||||
alias filter_prepend filter_unshift
|
||||
|
||||
# Re-open the log adapter if supported. This might be a no-op if the adapter
|
||||
# does not support reopening. This method is called by the logger's {Sink}.
|
||||
|
||||
@ -213,18 +213,18 @@ describe Rackstash::Flow do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#filter_prepend' do
|
||||
describe '#filter_unshift' do
|
||||
it 'calls FilterChain#unshift' do
|
||||
expect(flow.filter_chain).to receive(:unshift).twice.and_call_original
|
||||
|
||||
expect(flow.filter_prepend ->(event) { event }).to equal flow
|
||||
expect(flow.filter_prepend { |event| event }).to equal flow
|
||||
expect(flow.filter_unshift ->(event) { event }).to equal flow
|
||||
expect(flow.filter_unshift { |event| event }).to equal flow
|
||||
|
||||
expect(flow.filter_chain.size).to eql 2
|
||||
end
|
||||
|
||||
it 'can use the #filter_unshift alias' do
|
||||
expect(flow.method(:filter_unshift)).to eql flow.method(:filter_prepend)
|
||||
it 'can use the #filter_prepend alias' do
|
||||
expect(flow.method(:filter_prepend)).to eql flow.method(:filter_unshift)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user