Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use global stub method.

  • Loading branch information...
commit dbeff71d96e7153c9089ae23b4d6b58b295db4f7 1 parent 95bcaac
@i0rek authored
Showing with 6 additions and 9 deletions.
  1. +6 −9 lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb
View
15 lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb
@@ -96,12 +96,10 @@ def self.stub_typhoeus(request_signature, webmock_response, typhoeus)
)
end
-
- typhoeus.stub(
- request_signature.method || :any,
- /.*/,
- :webmock_stub => true
- ).and_return(response)
+ Typhoeus.stub(
+ nil,
+ :method => request_signature.method,
+ ).stubbed_from(:webmock).and_return(response)
end
def self.request_hash(request_signature)
@@ -166,9 +164,8 @@ def queue_with_webmock(request)
alias_method :queue, :queue_with_webmock
def clear_webmock_stubs
- self.stubs = [] unless self.stubs
- self.stubs.delete_if {|s|
- s.instance_variable_get(:@options)[:webmock_stub]
+ Typhoeus::Expectation.all.delete_if {|e|
+ e.from == :webmock
}
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.