spec/multi_spec.rb in em-synchrony-1.0.4 vs spec/multi_spec.rb in em-synchrony-1.0.5
- old
+ new
@@ -7,7 +7,23 @@
m = EM::Synchrony::Multi.new
m.add :df1, EM::DefaultDeferrable.new
m.add :df1, EM::DefaultDeferrable.new
end.should raise_error("Duplicate Multi key")
end
+
+ context "when defferable succeeded before adding" do
+ it "does not succeed twice" do
+ multi = EM::Synchrony::Multi.new
+ multi.should_receive(:succeed).once
+
+ slow = EM::DefaultDeferrable.new
+ multi.add :slow, slow
+
+ quick = EM::DefaultDeferrable.new
+ quick.succeed
+ multi.add :quick, quick
+
+ slow.succeed
+ end
+ end
end
-end
\ No newline at end of file
+end