Permalink
Browse files

fix nested failure messages

Signed-off-by: Jeremy McAnally <jeremymcanally@gmail.com>
  • Loading branch information...
1 parent d725734 commit 55e64c17d5c550985fc57055124557aa259b9408 @technoweenie technoweenie committed with Jan 29, 2009
Showing with 8 additions and 10 deletions.
  1. +1 −1 lib/matchy/built_in/operator_expectations.rb
  2. +7 −9 test/test_operator_expectations.rb
@@ -82,7 +82,7 @@ def pass!
end
def fail!(operator)
- flunk failure_message(@match ? failure_message(operator) : negative_failure_message(operator))
+ flunk @match ? failure_message(operator) : negative_failure_message(operator)
end
def failure_message(operator)
@@ -138,22 +138,20 @@ def test_negative_matches_fails
def test_fail_message
obj = Matchy::Expectations::OperatorExpectation.new(3, true)
- def obj.fail!(fail)
+ def obj.flunk(msg)
+ msg
end
- obj == 4
-
- obj.send(:failure_message, "==").should =~ /Expected 3 to == 4./
+ (obj == 4).should == "Expected 3 to == 4."
end
def test_negative_fail_message
- obj = Matchy::Expectations::OperatorExpectation.new(3, true)
+ obj = Matchy::Expectations::OperatorExpectation.new(3, false)
- def obj.fail!(fail)
+ def obj.flunk(msg)
+ msg
end
- obj == 3
-
- obj.send(:negative_failure_message, "==").should =~ /Expected 3 to not == 3./
+ (obj == 3).should == "Expected 3 to not == 3."
end
end

0 comments on commit 55e64c1

Please sign in to comment.