Skip to content
trans edited this page Feb 10, 2013 · 1 revision

Assertionless

Ruby Test supports assertionless testing. Assertionless testing means the test procedures that return false or nil are considered failures and will raise an assertion error. This allows tests to be written without the use of any assertion framework. Assertion testing, on the other hand, requires the use of an assertions framework in order to make test assertions, in which case the return value of a test procedure is simply ignored. The default mode is assertion testing. To change it, set the mode via the assertionless configuration option.

Test::Runner.assertionless = true

Users can override this mode, using the hard configuration option.

Test.configure do |run|
  run.hard = false
end

Note that assertions can still be used even when assertionless mode is active, because assertions are simply raise exceptions with their assertion? flag set to true.

Clone this wiki locally