method

throw_symbol

Importance_2
throw_symbol(expected_symbol = nil, expected_arg=nil) public

Given no argument, matches if a proc throws any Symbol.

Given a Symbol, matches if the given proc throws the specified Symbol.

Given a Symbol and an arg, matches if the given proc throws the specified Symbol with the specified arg.

Examples

  lambda { do_something_risky }.should throw_symbol
  lambda { do_something_risky }.should throw_symbol(:that_was_risky)
  lambda { do_something_risky }.should throw_symbol(:that_was_risky, culprit)

  lambda { do_something_risky }.should_not throw_symbol
  lambda { do_something_risky }.should_not throw_symbol(:that_was_risky)
  lambda { do_something_risky }.should_not throw_symbol(:that_was_risky, culprit)
Show source
Register or log in to add new notes.