spec/emitter_spec.rb in http-2-0.6.1 vs spec/emitter_spec.rb in http-2-0.6.3
- old
+ new
@@ -29,9 +29,17 @@
@w.emit(:a, 123)
args.should eq 123
end
+ it "should pass emitted callbacks to listeners" do
+ @w.on(:a) { |&block| block.call }
+ @w.once(:a) { |&block| block.call }
+ @w.emit(:a) { @cnt += 1 }
+
+ @cnt.should eq 2
+ end
+
it "should allow events with no callbacks" do
expect { @w.emit(:missing) }.to_not raise_error
end
it "should execute callback exactly once" do