deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r1199729 - /incubator/deltacloud/trunk/server/tests/drivers/google/setup.rb
Date Wed, 09 Nov 2011 13:00:20 GMT
Author: marios
Date: Wed Nov  9 13:00:20 2011
New Revision: 1199729

URL: http://svn.apache.org/viewvc?rev=1199729&view=rev
Log:
Monkey patch fix for VCR normalisation code

Needed in order to run google unit tests -
see https://github.com/myronmarston/vcr/issues/101

Modified:
    incubator/deltacloud/trunk/server/tests/drivers/google/setup.rb

Modified: incubator/deltacloud/trunk/server/tests/drivers/google/setup.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/google/setup.rb?rev=1199729&r1=1199728&r2=1199729&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/tests/drivers/google/setup.rb (original)
+++ incubator/deltacloud/trunk/server/tests/drivers/google/setup.rb Wed Nov  9 13:00:20 2011
@@ -11,3 +11,28 @@ VCR.config do |c|
   c.stub_with :excon
   c.default_cassette_options = { :record => :new_episodes}
 end
+
+#monkey patch fix for VCR normalisation code:
+#see https://github.com/myronmarston/vcr/issues/4
+#when body is a tempfile, like when creating new blob
+#this method of normalisation fails and excon throws errors
+#(Excon::Errors::SocketError:can't convert Tempfile into String)
+#
+#RELEVANT: https://github.com/myronmarston/vcr/issues/101
+#(will need revisiting when vcr 2 comes along)
+
+module VCR
+  module Normalizers
+    module Body
+
+    private
+    def normalize_body
+     self.body = case body
+          when nil, ''; nil
+          else
+            String.new(body) unless body.is_a?(Tempfile)
+        end
+      end
+    end
+  end
+end



Mime
View raw message