Add with_message modifier to raise_error matcher

This commit is contained in:
Michael Miller 2020-01-06 23:46:38 -07:00
parent 6a0a73ca76
commit d5c5a82395

View file

@ -90,6 +90,11 @@ module Spectator::Matchers
end
end
def with_message(message : T) forall T
value = TestValue.new(message)
ExceptionMatcher(ExceptionType, T).new(value)
end
# Runs a block of code and returns the exception it threw.
# If no exception was thrown, *nil* is returned.
private def capture_exception