Bugs: Browse | Submit New | Admin

[#28836] ExpectationError shouldn't subclass StandardError

Date:
2011-01-07 17:50
Priority:
3
Submitted By:
Ryan Kennedy (ryankennedy)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
ExpectationError shouldn't subclass StandardError

Detailed description
I have a test with the following expectation...

mock_service.expects(:foo).once.with(instance_of(Bar))

The code path executes the foo() method twice, however it does so inside of a begin/rescue/end block…

begin
    thing.foo(Bar.new())
rescue StandardError => e
    log("caught an error, logging and continuing")
end

As a result, the ExpectationError never makes its way out of the code. If ExpectationError were to extend Exception
then the right thing would happen…the second invocation would cause the test to fail. Instead, my test passes without
indicating to me that I actually have a bug.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2011-01-08 12:15
Sender: James Mead

Hi Ryan,

I believe this was fixed in Mocha v0.9.10.

Lighthouse Ticket [1]
Github Issue [2]
Relevant Commits [3,4]

Please let me know if this is not the case, otherwise please
close this bug report.

Thanks, James.
---
http://jamesmead.org/

[1] http://floehopper.lighthouseapp.com/projects/22289/tickets/1-
mochaexpectationerror-exception
[2] https://github.com/floehopper/mocha/issues/closed#issue/15
[3] https://github.com/floehopper/mocha/commit/fdcb15039062937454
44d8bf49ee624fa7839f75
[4] https://github.com/floehopper/mocha/commit/e2c5f3e06e459356a3
6e04a2e9959ca0f467125b

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item