Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions lib/sus/raise_exception.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,12 @@ def call(assertions, subject)

# Didn't throw any exception, so the expectation failed:
assertions.assert(false, self)
rescue => exception
# Did we throw the right kind of exception?
if exception.is_a?(@exception_class)
# Did it have the right message?
if @message
assertions.assert(@message === exception.message)
else
assertions.assert(true, self)
end
rescue @exception_class => exception
# Did it have the right message?
if @message
assertions.assert(@message === exception.message)
else
raise
assertions.assert(true, self)
end
end
end
Expand Down