spec/arborist/observer/action_spec.rb in arborist-0.3.0 vs spec/arborist/observer/action_spec.rb in arborist-0.4.0

- old
+ new

@@ -75,9 +75,34 @@ end end + context "ignoring flapping nodes" do + + before( :each ) do + @call_count = 0 + @last_call_arguments = nil + end + + let( :action ) do + described_class.new( ignore_flapping: true ) do |args| + @call_count += 1 + @last_call_arguments = args + end + end + + let( :flapping_event ) { { 'flapping' => true } } + + it "calls its block if the event is generated by a node that is not flapping" do + expect { action.handle_event(event) }.to change { @call_count }.by( 1 ) + end + + it "doesn't call its block if the event is generated by a flapping node" do + expect { action.handle_event(flapping_event) }.to_not change { @call_count } + end + end + # within: 0, after: 1, during: nil context "with a time threshold" do