Sha256: 463160cd76172d69bde1ea17b41c5682108d59e78e5ee433c6843ecc3422a3f3

Contents?: true

Size: 1003 Bytes

Versions: 92

Compression:

Stored size: 1003 Bytes

Contents

begin
  require 'minitest/test'
  test_class = Minitest::Test
  assertions = "assertions"
rescue LoadError
  require "minitest/unit"
  test_class = MiniTest::Unit::TestCase
  assertions = "_assertions"
end

require 'webmock'

test_class.class_eval do
  include WebMock::API

  alias_method :teardown_without_webmock, :teardown
  def teardown_with_webmock
    teardown_without_webmock
    WebMock.reset!
  end
  alias_method :teardown, :teardown_with_webmock

  [:assert_request_requested, :assert_request_not_requested].each do |name|
    alias_method :"#{name}_without_assertions_count", name
    define_method :"#{name}_with_assertions_count" do |*args|
      self.send("#{assertions}=", self.send("#{assertions}") + 1)
      send :"#{name}_without_assertions_count", *args
    end
    alias_method name, :"#{name}_with_assertions_count"
  end
end

begin
  error_class = MiniTest::Assertion
rescue NameError
  error_class = Minitest::Assertion
end

WebMock::AssertionFailure.error_class = error_class

Version data entries

92 entries across 90 versions & 9 rubygems

Version Path
cloudsmith-api-2.0.15 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.14 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.13 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.12 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.11 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.10 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.9 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.8 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.7 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.6 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.5 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.4 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.3 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.2 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.1 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-2.0.0 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-1.142.3 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-1.120.3 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-1.61.3 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb
cloudsmith-api-1.42.3 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/minitest.rb