# File lib/matchy/built_in/error_expectations.rb, line 12
      def raise_error(*obj)
        build_matcher(:raise_error, obj) do |receiver, matcher, args|
          expected = args[0] || Exception
          raised = false
          error = nil
          begin
            receiver.call
          rescue Exception => e
            raised = true
            error = e
          end
          if expected.respond_to?(:ancestors) && expected.ancestors.include?(Exception)
            matcher.positive_failure_message = "Expected #{receiver.inspect} to raise #{expected.name}, " + 
              (error ? "but #{error.class.name} was raised instead." : "but none was raised.")
            matcher.negative_failure_message = "Expected #{receiver.inspect} to not raise #{expected.name}."
            comparison = (raised && error.class.ancestors.include?(expected))
          else
            message = error ? error.message : "none"
            matcher.positive_failure_message = "Expected #{receiver.inspect} to raise error with message matching '#{expected}', but '#{message}' was raised."
            matcher.negative_failure_message = "Expected #{receiver.inspect} to raise error with message not matching '#{expected}', but '#{message}' was raised."
            comparison = (raised && (expected.kind_of?(Regexp) ? ((error.message =~ expected) ? true : false) : expected == error.message))
          end
          comparison
        end
      end