module RSpec::Matchers

def throw_symbol(expected_symbol=nil, expected_arg=nil)

expect { do_something_risky }.not_to throw_symbol(:that_was_risky, 'culprit')
expect { do_something_risky }.not_to throw_symbol(:that_was_risky)
expect { do_something_risky }.not_to throw_symbol

expect { do_something_risky }.to throw_symbol(:that_was_risky, 'culprit')
expect { do_something_risky }.to throw_symbol(:that_was_risky)
expect { do_something_risky }.to throw_symbol

@example

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

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

Given no argument, matches if a proc throws any Symbol.
def throw_symbol(expected_symbol=nil, expected_arg=nil)
  BuiltIn::ThrowSymbol.new(expected_symbol, expected_arg)
end