summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-12-15 11:03:21 -0600
committerLuke Kanies <luke@madstop.com>2008-12-18 11:10:24 -0600
commite601babb9266258f55580fcf2a91ea5ca4c5d368 (patch)
tree13ce5396f05daf2189f6c932b486e9b1d7558bdb /spec
parentf69ac9fdb916787530fb70f00006fa64952a8d45 (diff)
downloadpuppet-e601babb9266258f55580fcf2a91ea5ca4c5d368.tar.gz
puppet-e601babb9266258f55580fcf2a91ea5ca4c5d368.tar.xz
puppet-e601babb9266258f55580fcf2a91ea5ca4c5d368.zip
Supporting a nil expirer on cacher objects.
This works for those classes like Puppet::Type that use an expirer that isn't always present (they use their catalog as an expirer). The behaviour is now that if there is no expirer, expire() is a no-op and all data is considered expired all the time, so it's always fresh. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/util/cacher.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/unit/util/cacher.rb b/spec/unit/util/cacher.rb
index 3e8d31a24..5a867c6c1 100755
--- a/spec/unit/util/cacher.rb
+++ b/spec/unit/util/cacher.rb
@@ -79,6 +79,21 @@ describe Puppet::Util::Cacher do
@object.instance_cache.should_not equal(value)
end
+ it "should be able to trigger expiration on its expirer" do
+ @expirer.expects(:expire)
+ @object.expire
+ end
+
+ it "should do nothing when asked to expire when no expirer is available" do
+ cacher = CacheTest.new
+ class << cacher
+ def expirer
+ nil
+ end
+ end
+ lambda { cacher.expire }.should_not raise_error
+ end
+
it "should be able to cache false values" do
@object.expects(:init_instance_cache).returns false
@object.instance_cache.should be_false