Description: Fix tests to run with new ruby-mocks
 In new versions of ruby-mocks, the use of doubles or partial doubles from 
 rspec-mocks outside of the per-test lifecycle is not supported. Fix the tests
 to use a temporary scope
Author: Balasankar C <balasankarc@autistici.org>
Last-Update: 2015-07-08
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/spec/http/http_error_spec.rb
+++ b/spec/http/http_error_spec.rb
@@ -10,15 +10,17 @@
 
 describe "Yajl HTTP error" do
   before(:all) do
-    @request = File.new(File.expand_path(File.dirname(__FILE__) + "/fixtures/http.error.dump"), 'r')
-    @uri = 'file://'+File.expand_path(File.dirname(__FILE__) + "/fixtures/http/http.error.dump")
-    TCPSocket.should_receive(:new).and_return(@request)
-    @request.should_receive(:write)
+    RSpec::Mocks.with_temporary_scope do
+        @request = File.new(File.expand_path(File.dirname(__FILE__) + "/fixtures/http.error.dump"), 'r')
+        @uri = 'file://'+File.expand_path(File.dirname(__FILE__) + "/fixtures/http/http.error.dump")
+        TCPSocket.should_receive(:new).and_return(@request)
+        @request.should_receive(:write)
 
-    begin
-      Yajl::HttpStream.get(@uri)
-    rescue Yajl::HttpStream::HttpError => e
-      @error = e
+        begin
+          Yajl::HttpStream.get(@uri)
+        rescue Yajl::HttpStream::HttpError => e
+          @error = e
+        end
     end
   end
 
@@ -29,4 +31,4 @@
   it "should provide the HTTP response headers" do
     @error.headers.keys.should include('ETag', 'Content-Length', 'Server')
   end
-end
\ No newline at end of file
+end
