def exception_raised? subject, context, *args
      if context[:right_proc]
        args.any? && raise(ArgumentError, 'Both arguments and block given. Please use either one.')
        return MiniSpec::ExceptionInspector.raised_as_expected_by_proc?(subject, context)
      end

      type, match = nil
      args.each { |a| a.is_a?(Class) ? type = a : match = a }
      regexp = match.is_a?(Regexp) ? match : /^#{Regexp.escape(match.to_s)}\z/

      context = {negation: context[:negation]} # it is critical to not alter received context
      if context[:is_a_exception]         = subject.is_a?(Exception)
        context[:valid_exception_type]    = type  ? (subject.class == type)  : nil
        context[:valid_exception_message] = match ? (subject.to_s =~ regexp) : nil
      end

      MiniSpec::ExceptionInspector.raised_as_expected?(subject, type, match, context)
    end
def exception_raised? subject, context, *args
      if context[:right_proc]
        args.any? && raise(ArgumentError, 'Both arguments and block given. Please use either one.')
        return MiniSpec::ExceptionInspector.raised_as_expected_by_proc?(subject, context)
      end

      type, match = nil
      args.each { |a| a.is_a?(Class) ? type = a : match = a }
      regexp = match.is_a?(Regexp) ? match : /^#{Regexp.escape(match.to_s)}\z/

      context = {negation: context[:negation]} # it is critical to not alter received context
      if context[:is_a_exception]         = subject.is_a?(Exception)
        context[:valid_exception_type]    = type  ? (subject.class == type)  : nil
        context[:valid_exception_message] = match ? (subject.to_s =~ regexp) : nil
      end

      MiniSpec::ExceptionInspector.raised_as_expected?(subject, type, match, context)
    end
checks whether given object is a exception of given class(if any),
 and/or match given String/Regexp(if any)

 if no args given any raised exception accepted.
 if a class given it checks whether raised exception is of given type.
 if a string or regexp given it checks whether raised message matches it.

 @param subject potentially a Exception instance
 @param [Hash]  context
 @param [Array] *args  actual expectations. can be a Class, String or Regexp
 @return [ExceptionError] if not raised as expected
         [true]           if raised an exception that meets expectations