Example:
...
describe "MockExpectationError can be caught by code and prevent spec from failing" do
it "should fail, but does not" do
s = "string"
s.should_not receive(:length)
begin
l=s.length
rescue Exception
end
end
end
Note that while not generally good to do, in some cases digesting Exception is necessary (especially when designing
resilient frameworks). One must still validate some behavior that may not float the exception back to the spec.
A temporary hack to work around it used in our code base is attached. |