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/27 18:54:49 UTC
git commit: CIMI Tests: allow forcing a refetch of an existing model
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 <lu...@redhat.com>
Authored: Tue Nov 27 09:53:01 2012 -0800
Committer: David Lutterkort <lu...@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|