Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

No need for this global "seen request" tracking now that we're handli…

…ng Net::HTTP's recursion directly.
  • Loading branch information...
commit 0b17104a746f48db0ca1794a91ffce1a4eb222ee 1 parent 22915c4
@myronmarston authored
View
21 lib/vcr/library_hooks/fakeweb.rb
@@ -26,33 +26,12 @@ def handle
invoke_after_request_hook(@vcr_response) unless @recursing
end
- class << self
- def already_seen_requests
- @@already_seen_requests ||= Set.new
- end
- end
-
private
def externally_stubbed?
::FakeWeb.registered_uri?(request_method, uri)
end
- def invoke_before_request_hook
- unless self.class.already_seen_requests.include?(request.object_id)
- super
- # we use the object_id so that if there is bug that causes
- # us not to fully cleanup, we'll only be leaking the memory
- # of one integer, not the whole request object.
- self.class.already_seen_requests << request.object_id
- end
- end
-
- def invoke_after_request_hook(vcr_response)
- self.class.already_seen_requests.delete(request.object_id)
- super
- end
-
def on_externally_stubbed_request
# just perform the request--FakeWeb will handle it
perform_request(:started)
View
11 spec/vcr/library_hooks/fakeweb_spec.rb
@@ -18,16 +18,7 @@ def directly_stub_request(method, url, response_body)
::FakeWeb.register_uri(method, url, :body => response_body)
end
- it_behaves_like 'a hook into an HTTP library', :fakeweb, 'net/http' do
- before(:each) do
- VCR::LibraryHooks::FakeWeb::RequestHandler.already_seen_requests.clear
- end
-
- after(:each) do
- # assert that we are cleaning up the global state after every request
- VCR::LibraryHooks::FakeWeb::RequestHandler.already_seen_requests.to_a.should eq([])
- end
- end
+ it_behaves_like 'a hook into an HTTP library', :fakeweb, 'net/http'
describe "some specific Net::HTTP edge cases" do
before(:each) do
Please sign in to comment.
Something went wrong with that request. Please try again.