method

assert_throw

ruby latest stable - Class: Test::Unit::Assertions

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2_1_10) is shown here.

assert_throw(tag, msg = nil)
public

Fails unless the given block throws tag, returns the caught value otherwise.

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

tag = Object.new
assert_throw(tag, "#{tag} was not thrown!") do
  throw tag
end