Created
December 8, 2009 07:01
-
-
Save marcandre/251469 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
diff --git a/lib/mspec/expectations/should.rb b/lib/mspec/expectations/should.rb | |
index 6a37401..6cd7030 100644 | |
--- a/lib/mspec/expectations/should.rb | |
+++ b/lib/mspec/expectations/should.rb | |
@@ -1,8 +1,9 @@ | |
class Object | |
- def should(matcher=nil) | |
+ NO_MATCHER_GIVEN = Object.new | |
+ def should(matcher=NO_MATCHER_GIVEN) | |
MSpec.expectation | |
MSpec.actions :expectation, MSpec.current.state | |
- if matcher | |
+ unless matcher.equal?(NO_MATCHER_GIVEN) | |
unless matcher.matches?(self) | |
SpecExpectation.fail_with(*matcher.failure_message) | |
end | |
@@ -11,10 +12,10 @@ class Object | |
end | |
end | |
- def should_not(matcher=nil) | |
+ def should_not(matcher=NO_MATCHER_GIVEN) | |
MSpec.expectation | |
MSpec.actions :expectation, MSpec.current.state | |
- if matcher | |
+ unless matcher.equal?(NO_MATCHER_GIVEN) | |
if matcher.matches?(self) | |
SpecExpectation.fail_with(*matcher.negative_failure_message) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment