spec/em-dextras/chains_spec.rb in em-dextras-0.3.0 vs spec/em-dextras/chains_spec.rb in em-dextras-0.4.0
- old
+ new
@@ -32,10 +32,16 @@
def todo(input)
EMDextras::Chains::Deferrables.failed input
end
end
+ class RaisingExceptionStage
+ def todo(input)
+ raise StandardError, input.to_s
+ end
+ end
+
class InvalidStage
def todo(input)
"not-a-deferrable"
end
end
@@ -154,12 +160,20 @@
end
end
end
context "- monitoring -" do
- it "should notify monitoring of any exceptions" do
+ it "should notify monitoring of any failure" do
EM.run do
EMDextras::Chains.pipe("anything", monitoring, [ErrorStage.new]);
+
+ monitoring.received_call!(:inform_exception!, any_args)
+ end
+ end
+
+ it "should notify monitoring of any exception" do
+ EM.run do
+ EMDextras::Chains.pipe("will raise", monitoring, [RaisingExceptionStage.new]);
monitoring.received_call!(:inform_exception!, any_args)
end
end