Sha256: edb5fedac0a3697a524ba2c3db5356a295c47e6a41be10e8cc7ac20fd1850f82

Contents?: true

Size: 704 Bytes

Versions: 7

Compression:

Stored size: 704 Bytes

Contents

require 'minitest/unit'
require 'webmock'

MiniTest::Unit::TestCase.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._assertions += 1
      send :"#{name}_without_assertions_count", *args
    end
    alias_method name, :"#{name}_with_assertions_count"
  end
end

WebMock::AssertionFailure.error_class = MiniTest::Assertion

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
webmock-1.11.0 lib/webmock/minitest.rb
webmock-1.10.2 lib/webmock/minitest.rb
webmock-1.10.1 lib/webmock/minitest.rb
webmock-1.10.0 lib/webmock/minitest.rb
webmock-1.9.3 lib/webmock/minitest.rb
webmock-1.9.2 lib/webmock/minitest.rb
webmock-1.9.1 lib/webmock/minitest.rb