Method: Test::Unit::Assertions#assert_no_match

Defined in:
lib/test/unit/assertions.rb

#assert_no_match(regexp, string, msg = nil) ⇒ Object

:call-seq:

assert_no_match( regexp, string, failure_message = nil )

Tests if the given Regexp does not match a given String.

An optional failure message may be provided as the final argument.



281
282
283
284
285
286
# File 'lib/test/unit/assertions.rb', line 281

def assert_no_match(regexp, string, msg=nil)
  assert_instance_of(Regexp, regexp, "The first argument to assert_no_match should be a Regexp.")
  self._assertions -= 1
  msg = message(msg) { "<#{mu_pp(regexp)}> expected to not match\n<#{mu_pp(string)}>" }
  assert(regexp !~ string, msg)
end