Created
November 6, 2010 15:28
-
-
Save rubiii/665482 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe "#expects" do | |
| before { something.expects(:some_method) } | |
| around do |example| | |
| begin | |
| example.run | |
| rescue Mocha::ExpectationError => e | |
| e.message.should include("expected exactly once, not yet invoked: SomeObject.some_method") | |
| end | |
| end | |
| it "should fail, raise an expectation_error and still pass (weird)" do | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe "#expects" do | |
| before { something.expects(:some_method) } | |
| it "should fail" do | |
| expect { verify_mocks_for_rspec }.to raise_error( | |
| Mocha::ExpectationError, | |
| /expected exactly once, not yet invoked: SomeObject.some_method/ | |
| ) | |
| teardown_mocks_for_rspec | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hey myron, thanks for your comment. i refactored the example to use rspec's mock methods and it seems to work fine. thanks again :)