From 498994aa0e2a40116b541e1575b33cb42f3c1f2a Mon Sep 17 00:00:00 2001 From: Jacob Green Date: Tue, 26 Jun 2012 21:33:26 -0700 Subject: [PATCH] Failing test for reusing net/http request in Fakeweb --- spec/vcr/library_hooks/fakeweb_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/vcr/library_hooks/fakeweb_spec.rb b/spec/vcr/library_hooks/fakeweb_spec.rb index 8e0835e7..79a650c5 100644 --- a/spec/vcr/library_hooks/fakeweb_spec.rb +++ b/spec/vcr/library_hooks/fakeweb_spec.rb @@ -95,6 +95,21 @@ def make_post_request ignored_body.should_not eq(recorded_body) ignored_body.should match(/Response \d+/) end + + it "Make request twice against cassette using the same http request object" do + uri = URI.parse("http://localhost:#{VCR::SinatraApp.port}/foo") + http = Net::HTTP.new(uri.host, uri.port) + VCR.use_cassette("new_cassette", :record => :once) do + request = Net::HTTP::Get.new(uri.request_uri) + http.request(request) + end + + VCR.use_cassette("new_cassette", :record => :once) do + request = Net::HTTP::Get.new(uri.request_uri) + http.request(request) + http.request(request) + end + end end describe "VCR.configuration.after_library_hooks_loaded hook" do