spec/out_stats_spec.rb in fluent-plugin-stats-0.3.3 vs spec/out_stats_spec.rb in fluent-plugin-stats-0.3.4
- old
+ new
@@ -188,10 +188,11 @@
CONFIG + %[
add_tag_prefix foo
sum _count$
]
end
+ let(:tag) { 'foo.bar' }
before do
Fluent::Engine.stub(:now).and_return(time)
Fluent::Engine.should_receive(:emit).with("foo.#{tag}", time, {
"4xx_count"=>6,"5xx_count"=>6
})
@@ -204,12 +205,47 @@
CONFIG + %[
remove_tag_prefix foo
sum _count$
]
end
+ let(:tag) { 'foo.bar' }
before do
Fluent::Engine.stub(:now).and_return(time)
Fluent::Engine.should_receive(:emit).with("bar", time, {
+ "4xx_count"=>6,"5xx_count"=>6
+ })
+ end
+ it { emit }
+ end
+
+ context 'add_tag_suffix' do
+ let(:config) do
+ CONFIG + %[
+ add_tag_suffix foo
+ sum _count$
+ ]
+ end
+ let(:tag) { 'foo.bar' }
+ before do
+ Fluent::Engine.stub(:now).and_return(time)
+ Fluent::Engine.should_receive(:emit).with("#{tag}.foo", time, {
+ "4xx_count"=>6,"5xx_count"=>6
+ })
+ end
+ it { emit }
+ end
+
+ context 'remove_tag_suffix' do
+ let(:config) do
+ CONFIG + %[
+ remove_tag_suffix bar
+ sum _count$
+ ]
+ end
+ let(:tag) { 'foo.bar' }
+ before do
+ Fluent::Engine.stub(:now).and_return(time)
+ Fluent::Engine.should_receive(:emit).with("foo", time, {
"4xx_count"=>6,"5xx_count"=>6
})
end
it { emit }
end