From 212b3e3dff7cb8846e0d09d39faf226b60c62e6b Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Fri, 23 Jan 2009 16:56:14 -0600 Subject: Allowing the Indirection cache to be reset to nil Otherwise we couldn't disable a cache once configured. Signed-off-by: Luke Kanies --- lib/puppet/indirector/indirection.rb | 2 +- spec/unit/indirector/indirection.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb index c560bb5b7..2eac2395b 100644 --- a/lib/puppet/indirector/indirection.rb +++ b/lib/puppet/indirector/indirection.rb @@ -47,7 +47,7 @@ class Puppet::Indirector::Indirection attr_reader :cache_class # Define a terminus class to be used for caching. def cache_class=(class_name) - validate_terminus_class(class_name) + validate_terminus_class(class_name) if class_name @cache_class = class_name end diff --git a/spec/unit/indirector/indirection.rb b/spec/unit/indirector/indirection.rb index 71dc4d24f..51bd45473 100755 --- a/spec/unit/indirector/indirection.rb +++ b/spec/unit/indirector/indirection.rb @@ -690,8 +690,9 @@ describe Puppet::Indirector::Indirection do proc { @indirection.cache_class = "" }.should raise_error(ArgumentError) end - it "should fail to set the cache class when the cache class name is nil" do - proc { @indirection.cache_class = nil }.should raise_error(ArgumentError) + it "should allow resetting the cache_class to nil" do + @indirection.cache_class = nil + @indirection.cache_class.should be_nil end it "should fail to set the cache class when the specified cache class cannot be found" do -- cgit