module Minitest #:nodoc:
  class Test #:nodoc:
    # Override capture_exceptions to recognize BRASS assertion errors
    # as test failures rather than errors.
    alias_method :capture_exceptions_without_brass, :capture_exceptions

    def capture_exceptions
      yield
    rescue *PASSTHROUGH_EXCEPTIONS
      raise
    rescue Assertion => e
      self.failures << e
    rescue Exception => e
      if e.respond_to?(:assertion?) && e.assertion?
        failure = Assertion.new(e.message)
        failure.set_backtrace(e.backtrace)
        self.failures << failure
      else
        self.failures << UnexpectedError.new(sanitize_exception(e))
      end
    end
  end
end
