class CodeClimate::TestReporter::ExceptionMessage

Constants

HTTP_STUBBING_MESSAGES

Public Class Methods

new(exception) click to toggle source
# File lib/code_climate/test_reporter/exception_message.rb, line 36
def initialize(exception)
  @exception = exception
end

Public Instance Methods

message() click to toggle source
# File lib/code_climate/test_reporter/exception_message.rb, line 40
      def message
        parts = []
        parts << "Code Climate encountered an exception: #{exception_class}"
        if http_stubbing_exception
          message = http_stubbing_exception.new
          parts << "======"
          parts << "Hey! Looks like you are using #{message.library_name}, which will prevent the codeclimate-test-reporter from reporting results to codeclimate.com.
Add the following to your spec or test helper to ensure codeclimate-test-reporter can post coverage results:"
          parts << "\n" + message.instructions + "\n"
          parts << "======"
          parts << "If this doesn't work, please consult https://codeclimate.com/docs#test-coverage-troubleshooting"
          parts << "======"
        else
          parts << @exception.message
          @exception.backtrace.each do |line|
            parts << line
          end
        end
        parts.join("\n")
      end

Private Instance Methods

exception_class() click to toggle source
# File lib/code_climate/test_reporter/exception_message.rb, line 63
def exception_class
  @exception.class.to_s
end
http_stubbing_exception() click to toggle source
# File lib/code_climate/test_reporter/exception_message.rb, line 67
def http_stubbing_exception
  HTTP_STUBBING_MESSAGES[exception_class]
end