You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by lu...@redhat.com on 2012/11/05 20:24:42 UTC

[PATCH 1/4] CIMI Tests: cache last_response for each format, not just once

From: David Lutterkort <lu...@redhat.com>

Otherwise, last_response may return XML when we are doing the test against json
---
 tests/cimi/test_helper.rb |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/cimi/test_helper.rb b/tests/cimi/test_helper.rb
index 8fd850a..f1efaf8 100644
--- a/tests/cimi/test_helper.rb
+++ b/tests/cimi/test_helper.rb
@@ -150,14 +150,16 @@ class CIMI::Test::Spec < MiniTest::Spec
 
   def last_response
     @@_cache ||= {}
-    @@_cache[:last_response]
+    @@_cache[:last_response] ||= {}
+    @@_cache[:last_response][@format]
   end
 
   private
 
   def fetch_model(k, model_class, &block)
     response = instance_exec(@format, &block)
-    @@_cache[:last_response] = response
+    @@_cache[:last_response] ||= {}
+    @@_cache[:last_response][@format] = response
     assert_equal @content_type, response.headers[:content_type]
     # FIXME: for XML check that the correct namespace is set
     model_class.parse(response.body, @content_type)
-- 
1.7.7.6