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
Date Tue, 08 Nov 2011 15:04:40 GMT
From: marios <marios@redhat.com>

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

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

diff --git a/server/tests/drivers/google/setup.rb b/server/tests/drivers/google/setup.rb
index 09aea62..95924e5 100644
--- a/server/tests/drivers/google/setup.rb
+++ b/server/tests/drivers/google/setup.rb
@@ -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
-- 
1.7.6.4


Mime
View raw message