def assert_rejects(matcher, target, options = {})
if matcher.respond_to?(:in_context)
matcher.in_context(self)
end
not_match = matcher.respond_to?(:does_not_match?) ? matcher.does_not_match?(target) : !matcher.matches?(target)
if not_match
safe_assert_block { true }
if options[:message]
message = matcher.respond_to?(:failure_message_for_should) ? matcher.failure_message_for_should : matcher.failure_message
assert_match options[:message], message
end
else
message = matcher.respond_to?(:failure_message_for_should_not) ? matcher.failure_message_for_should_not : matcher.negative_failure_message
safe_assert_block(message) { false }
end
end