diff options
Diffstat (limited to 'spec/mspec/lib/mspec/expectations/should.rb')
-rw-r--r-- | spec/mspec/lib/mspec/expectations/should.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/mspec/lib/mspec/expectations/should.rb b/spec/mspec/lib/mspec/expectations/should.rb index f6d83053f5..231ad15c21 100644 --- a/spec/mspec/lib/mspec/expectations/should.rb +++ b/spec/mspec/lib/mspec/expectations/should.rb @@ -4,26 +4,26 @@ class Object def should(matcher = NO_MATCHER_GIVEN) MSpec.expectation MSpec.actions :expectation, MSpec.current.state - unless matcher.equal? NO_MATCHER_GIVEN + if NO_MATCHER_GIVEN.equal?(matcher) + SpecPositiveOperatorMatcher.new(self) + else unless matcher.matches? self expected, actual = matcher.failure_message SpecExpectation.fail_with(expected, actual) end - else - SpecPositiveOperatorMatcher.new(self) end end def should_not(matcher = NO_MATCHER_GIVEN) MSpec.expectation MSpec.actions :expectation, MSpec.current.state - unless matcher.equal? NO_MATCHER_GIVEN + if NO_MATCHER_GIVEN.equal?(matcher) + SpecNegativeOperatorMatcher.new(self) + else if matcher.matches? self expected, actual = matcher.negative_failure_message SpecExpectation.fail_with(expected, actual) end - else - SpecNegativeOperatorMatcher.new(self) end end end |