You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2012/11/06 23:37:04 UTC

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

CIMI Tests: cache last_response for each format, not just once

Otherwise, last_response may return XML when we are doing the test against json


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/e4249807
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/e4249807
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/e4249807

Branch: refs/heads/master
Commit: e4249807f36fa35b673ab570d7e241ce71d9751f
Parents: 4822d37
Author: David Lutterkort <lu...@redhat.com>
Authored: Fri Nov 2 15:00:54 2012 -0700
Committer: David Lutterkort <lu...@redhat.com>
Committed: Tue Nov 6 14:36:32 2012 -0800

----------------------------------------------------------------------
 tests/cimi/test_helper.rb |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e4249807/tests/cimi/test_helper.rb
----------------------------------------------------------------------
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)