Sha256: 6cf6420537dddbd9c148be5a5555d316ea18057ca311bdc608118c4bb261366e

Contents?: true

Size: 1.81 KB

Versions: 4709

Compression:

Stored size: 1.81 KB

Contents

require 'rspec/mocks'

module RSpec
  module Mocks
    # @private
    module MinitestIntegration
      include ::RSpec::Mocks::ExampleMethods

      def before_setup
        ::RSpec::Mocks.setup
        super
      end

      def after_teardown
        super

        # Only verify if there's not already an error. Otherwise
        # we risk getting the same failure twice, since negative
        # expectation violations raise both when the message is
        # unexpectedly received, and also during `verify` (in case
        # the first failure was caught by user code via a
        # `rescue Exception`).
        ::RSpec::Mocks.verify unless failures.any?
      ensure
        ::RSpec::Mocks.teardown
      end
    end
  end
end

Minitest::Test.send(:include, RSpec::Mocks::MinitestIntegration)

if defined?(::Minitest::Expectation)
  if defined?(::RSpec::Expectations) && ::Minitest::Expectation.method_defined?(:to)
    # rspec/expectations/minitest_integration has already been loaded and
    # has defined `to`/`not_to`/`to_not` on `Minitest::Expectation` so we do
    # not want to here (or else we would interfere with rspec-expectations' definition).
  else
    # ...otherwise, define those methods now. If `rspec/expectations/minitest_integration`
    # is loaded after this file, it'll override the definition here.
    Minitest::Expectation.class_eval do
      include RSpec::Mocks::ExpectationTargetMethods

      def to(*args)
        ctx.assertions += 1
        super
      end

      def not_to(*args)
        ctx.assertions += 1
        super
      end

      def to_not(*args)
        ctx.assertions += 1
        super
      end
    end
  end
end

module RSpec
  module Mocks
    remove_const :MockExpectationError
    # Raised when a message expectation is not satisfied.
    MockExpectationError = ::Minitest::Assertion
  end
end

Version data entries

4,709 entries across 4,709 versions & 31 rubygems

Version Path
cybrid_api_bank_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_id_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_organization_ruby-0.123.149 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_bank_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_id_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_organization_ruby-0.123.148 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_bank_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_organization_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_id_ruby-0.123.147 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
ory-client-1.16.2 vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_bank_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_organization_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_id_ruby-0.123.145 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_bank_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_id_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_organization_ruby-0.123.144 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
ory-client-1.16.1 vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
ory-client-1.16.0 vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_bank_ruby-0.123.143 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb
cybrid_api_organization_ruby-0.123.143 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/minitest_integration.rb