module Mocha::Integration::Minitest::Adapter
Integrates Mocha
into recent versions of Minitest
.
See the source code for an example of how to integrate Mocha
into a test library.
Public Class Methods
applicable_to?(minitest_version)
click to toggle source
@private
# File lib/mocha/integration/minitest/adapter.rb, line 15 def self.applicable_to?(minitest_version) Gem::Requirement.new('>= 3.3.0').satisfied_by?(minitest_version) end
description()
click to toggle source
@private
# File lib/mocha/integration/minitest/adapter.rb, line 20 def self.description 'adapter for Minitest gem >= v3.3.0' end
included(_mod)
click to toggle source
@private
# File lib/mocha/integration/minitest/adapter.rb, line 25 def self.included(_mod) Mocha::ExpectationErrorFactory.exception_class = ::Minitest::Assertion end
Public Instance Methods
after_teardown()
click to toggle source
@private
Calls superclass method
# File lib/mocha/integration/minitest/adapter.rb, line 45 def after_teardown super mocha_teardown end
before_setup()
click to toggle source
@private
Calls superclass method
# File lib/mocha/integration/minitest/adapter.rb, line 30 def before_setup mocha_setup super end
before_teardown()
click to toggle source
@private
Calls superclass method
# File lib/mocha/integration/minitest/adapter.rb, line 36 def before_teardown return unless passed? assertion_counter = Integration::AssertionCounter.new(self) mocha_verify(assertion_counter) ensure super end
mocha_test_name()
click to toggle source
@private
# File lib/mocha/integration/minitest/adapter.rb, line 51 def mocha_test_name if respond_to?(:name) test_name = name elsif respond_to?(:__name__) # Older minitest test_name = __name__ end if test_name "#{self.class.name}##{test_name}" else self.class.name end end