lib/matchbox.rb in matchbox-1.0.1 vs lib/matchbox.rb in matchbox-1.0.2
- old
+ new
@@ -22,20 +22,24 @@
# @param [#failure_message && #matches?] matcher
# @param [Object] target
# @raises [Test::Unit::AssertionFailedError] if the assertion fails
def assert_accepts(matcher, target)
matched = matcher.matches?(target)
- assert_block(matcher.failure_message) { matched }
+ message = matcher.failure_message
+
+ message ? assert(matched, message) : assert(matched)
end
# Asserts that a matcher does not match a given target.
#
# @param [#negative_failure_message && #matches?] matcher
# @param [Object] target
# @raises [Test::Unit::AssertionFailedError] if the assertion fails
def assert_rejects(matcher, target)
matched = matcher.matches?(target)
- assert_block(matcher.negative_failure_message) { !matched }
+ message = matcher.negative_failure_message
+
+ message ? assert(!matched, message) : assert(!matched)
end
end
module Test
module Unit
\ No newline at end of file