Sha256: 4c18a368ee6957e67ecb4915930773625576dd70d8ff17daa58bb990bb8a80b3

Contents?: true

Size: 1.21 KB

Versions: 28

Compression:

Stored size: 1.21 KB

Contents

require 'mocha/api'
require 'mocha/integration/assertion_counter'
require 'mocha/expectation_error_factory'

module Mocha
  module Integration
    module MiniTest
      # Integrates Mocha into recent versions of MiniTest.
      #
      # See the source code for an example of how to integrate Mocha into a test library.
      module Adapter
        include Mocha::API

        # @private
        def self.applicable_to?(mini_test_version)
          Gem::Requirement.new('>= 3.3.0').satisfied_by?(mini_test_version)
        end

        # @private
        def self.description
          'adapter for MiniTest gem >= v3.3.0'
        end

        # @private
        def self.included(_mod)
          Mocha::ExpectationErrorFactory.exception_class = ::MiniTest::Assertion
        end

        # @private
        def before_setup
          mocha_setup
          super
        end

        # @private
        def before_teardown
          return unless passed?
          assertion_counter = Integration::AssertionCounter.new(self)
          mocha_verify(assertion_counter)
        ensure
          super
        end

        # @private
        def after_teardown
          super
          mocha_teardown
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
mocha-2.0.4 lib/mocha/integration/mini_test/adapter.rb
mocha-2.0.3 lib/mocha/integration/mini_test/adapter.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/mocha-2.0.2/lib/mocha/integration/mini_test/adapter.rb
mocha-2.0.2 lib/mocha/integration/mini_test/adapter.rb
mocha-1.16.1 lib/mocha/integration/mini_test/adapter.rb
mocha-1.15.1 lib/mocha/integration/mini_test/adapter.rb
mocha-2.0.1 lib/mocha/integration/mini_test/adapter.rb
mocha-2.0.0 lib/mocha/integration/mini_test/adapter.rb
mocha-1.16.0 lib/mocha/integration/mini_test/adapter.rb
mocha-2.0.0.alpha.1 lib/mocha/integration/mini_test/adapter.rb
mocha-2.0.0.alpha lib/mocha/integration/mini_test/adapter.rb
mocha-1.15.0 lib/mocha/integration/mini_test/adapter.rb
mocha-1.14.0 lib/mocha/integration/mini_test/adapter.rb
mocha-1.13.0 lib/mocha/integration/mini_test/adapter.rb
mocha-1.12.0 lib/mocha/integration/mini_test/adapter.rb
mocha-1.11.2 lib/mocha/integration/mini_test/adapter.rb
mocha-1.11.1 lib/mocha/integration/mini_test/adapter.rb
mocha-1.11.0 lib/mocha/integration/mini_test/adapter.rb
mocha-1.10.2 lib/mocha/integration/mini_test/adapter.rb
mocha-1.10.1 lib/mocha/integration/mini_test/adapter.rb