You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by ma...@redhat.com on 2011/11/02 11:27:06 UTC
[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
From: marios <ma...@redhat.com>
Signed-off-by: marios <ma...@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