Sha256: 3baa052ab60a81c86e1b965446f6acf6c6400ceb4c5a02dff58fb53d95a7fb77
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true # # Abstraction over WebMock to reduce duplication # # @author Mikael Henriksson <mikael@zoolutions.se> # @since 0.1.0 # module StubRequests # # Module WebMock extends WebMock with more functionality # # @author Mikael Henriksson <mikael@zoolutions.se> # @since 0.1.2 # module WebMock # # Module StubRegistryExtension extends WebMock::StubRegistry with # recording of when a response was found and used for a WebMock::RequestStub # # @author Mikael Henriksson <mikael@zoolutions.se> # @since 0.1.2 # module StubRegistryExtension # :nodoc: def self.included(base) base.class_eval do alias_method :request_stub_for_orig, :request_stub_for alias_method :request_stub_for, :request_stub_for_ext end end private def request_stub_for_ext(request_signature) request_stub = request_stub_for_orig(request_signature) return request_stub unless request_stub Metrics::Registry.instance.mark_as_responded(request_stub) request_stub end end end end ::WebMock::StubRegistry.send(:include, StubRequests::WebMock::StubRegistryExtension)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stub_requests-0.1.3 | lib/stub_requests/webmock/stub_registry_extension.rb |
stub_requests-0.1.2 | lib/stub_requests/webmock/stub_registry_extension.rb |