Method: MiniTest::Assertions#assert

Defined in:
lib/minitest/unit.rb

#assert(test, msg = nil) ⇒ Object

Fails unless test is a true value.

[View source]

83
84
85
86
87
88
89
90
91
# File 'lib/minitest/unit.rb', line 83

def assert test, msg = nil
  msg ||= "Failed assertion, no message given."
  self._assertions += 1
  unless test then
    msg = msg.call if Proc === msg
    raise MiniTest::Assertion, msg
  end
  true
end