incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH 3/3] Monkey patch fix for VCR normalisation code in order to run google unit tests - will remove once this is fixed in vcr
Date Wed, 02 Nov 2011 10:27:06 GMT
From: marios <marios@redhat.com>


Signed-off-by: marios <marios@redhat.com>
---
 server/tests/drivers/google/setup.rb |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/server/tests/drivers/google/setup.rb b/server/tests/drivers/google/setup.rb
index ac6bacd..abb48da 100644
--- a/server/tests/drivers/google/setup.rb
+++ b/server/tests/drivers/google/setup.rb
@@ -11,3 +11,25 @@ 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)
+
+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
-- 
1.7.6.4


Mime
View raw message