macbacon - testing exceptions

19 views
Skip to first unread message

Nicholas Pachulski

unread,
May 27, 2015, 7:46:52 PM5/27/15
to rubym...@googlegroups.com
Does anyone know why the following:

  it "catches divide by zero exceptions" do
    lambda{ 1 / 0 }.should.not.raise(ZeroDivisionError)
  end

errors out of the test suite like so:

- catches divide by zero exceptions2015-05-27 19:42:47.349 mlp[93936:405506] *** Terminating app due to uncaught exception 'ZeroDivisionError', reason: 'spec.rb:753:in `satisfy:':
 divided by 0 (ZeroDivisionError)

followed by a stack trace rather than catching the error, logging it as a test failure?

Likewise, if I expect a block not to raise an error and it does, the test suite errors out with a stack trace. I wouldn't think that's the intended behavior.

Anyone have any insight? Thanks,

Nick

--
no trees were hurt transmitting this message, however several trillion electrons were terribly inconvenienced
Reply all
Reply to author
Forward
0 new messages