deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject git commit: CIMI Tests: allow forcing a refetch of an existing model
Date Tue, 27 Nov 2012 17:54:49 GMT
Updated Branches:
  refs/heads/master f518fa17f -> 74026c561


CIMI Tests: allow forcing a refetch of an existing model


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

Branch: refs/heads/master
Commit: 74026c561aee1b22f3bad95a9b0370ac363b4975
Parents: f518fa1
Author: David Lutterkort <lutter@redhat.com>
Authored: Tue Nov 27 09:53:01 2012 -0800
Committer: David Lutterkort <lutter@redhat.com>
Committed: Tue Nov 27 09:53:01 2012 -0800

----------------------------------------------------------------------
 tests/cimi/test_helper.rb |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/74026c56/tests/cimi/test_helper.rb
----------------------------------------------------------------------
diff --git a/tests/cimi/test_helper.rb b/tests/cimi/test_helper.rb
index c6d9c0c..29a8d71 100644
--- a/tests/cimi/test_helper.rb
+++ b/tests/cimi/test_helper.rb
@@ -210,9 +210,16 @@ class CIMI::Test::Spec < MiniTest::Spec
   end
 
   def self.model(name, opts = {}, &block)
-    define_method name do
+    define_method name do |*args|
       @_memoized ||= {}
       @@_cache ||= {}
+      if args[0].is_a?(Hash)
+        if args[0][:refetch]
+          k = "#{name}_#{@format}"
+          @_memoized.delete(k)
+          @@_cache.delete(k)
+        end
+      end
       resp = @_memoized.fetch("#{name}_#{@format}") do |k|
         if opts[:cache]
           @_memoized[k] = @@_cache.fetch(k) do |k|


Mime
View raw message