Method: MiniTest::Assertions#assert_match

Defined in:
lib/minitest/unit.rb

#assert_match(exp, act, msg = nil) ⇒ Object

Fails unless exp is =~ act.


174
175
176
177
178
179
# File 'lib/minitest/unit.rb', line 174

def assert_match exp, act, msg = nil
  msg = message(msg) { "Expected #{mu_pp(exp)} to match #{mu_pp(act)}" }
  assert_respond_to act, :"=~"
  exp = /#{Regexp.escape exp}/ if String === exp && String === act
  assert exp =~ act, msg
end