Module: Minitest::Reportable

Included in:
Result, Test
Defined in:
lib/minitest.rb

Overview

Shared code for anything that can get passed to a Reporter. See Minitest::Test & Minitest::Result.

Instance Method Summary collapse

Instance Method Details

#class_nameObject

:nodoc:

Raises:

  • (NotImplementedError)


463
464
465
# File 'lib/minitest.rb', line 463

def class_name # :nodoc:
  raise NotImplementedError, "subclass responsibility"
end

#error?Boolean

Did this run error?

Returns:

  • (Boolean)


484
485
486
# File 'lib/minitest.rb', line 484

def error?
  self.failures.any? { |f| UnexpectedError === f }
end

#locationObject

The location identifier of this test. Depends on a method existing called class_name.



458
459
460
461
# File 'lib/minitest.rb', line 458

def location
  loc = " [#{self.failure.location}]" unless passed? or error?
  "#{self.class_name}##{self.name}#{loc}"
end

#passed?Boolean

Did this run pass?

Note: skipped runs are not considered passing, but they don’t cause the process to exit non-zero.

Returns:

  • (Boolean)


450
451
452
# File 'lib/minitest.rb', line 450

def passed?
  not self.failure
end

#result_codeObject

Returns “.”, “F”, or “E” based on the result of the run.



470
471
472
# File 'lib/minitest.rb', line 470

def result_code
  self.failure and self.failure.result_code or "."
end

#skipped?Boolean

Was this run skipped?

Returns:

  • (Boolean)


477
478
479
# File 'lib/minitest.rb', line 477

def skipped?
  self.failure and Skip === self.failure
end