Skip to content

Instantly share code, notes, and snippets.

@marcandre
Created December 8, 2009 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcandre/251469 to your computer and use it in GitHub Desktop.
Save marcandre/251469 to your computer and use it in GitHub Desktop.
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