Hi
I’ve got code I want to intercept all errors (to report them) but re-
raise them immediately. Currently the raise_error matcher doesn’t
support matching against instances of exception classes, so I’ve done
this to prove that the actual exception was re-raised:
describe "when the update is unsuccessful" do
class WeirdError < StandardError; end
before(:each) do
@error = WeirdError.new("Error")
@server.stub!(:check_feeds).and_raise(@error)
end
it "should re-raise the exception" do
lambda { @connection.receive_data("UPDATE\n") }.
should raise_error(WeirdError)
end
end
Few questions:
Is this an appropriate behaviour to spec?
If so, is this currently the best way to do it?
If so, would exception instance matching be useful?
Thanks
Ashley