diff options
-rw-r--r-- | lib/puppet/file_serving/base.rb | 1 | ||||
-rw-r--r-- | lib/puppet/file_serving/fileset.rb | 2 | ||||
-rwxr-xr-x | spec/integration/indirector/rest.rb | 8 | ||||
-rwxr-xr-x | spec/unit/file_serving/base.rb | 4 |
4 files changed, 10 insertions, 5 deletions
diff --git a/lib/puppet/file_serving/base.rb b/lib/puppet/file_serving/base.rb index 2a0199dee..d1fa9dfd2 100644 --- a/lib/puppet/file_serving/base.rb +++ b/lib/puppet/file_serving/base.rb @@ -46,6 +46,7 @@ class Puppet::FileServing::Base # Determine how we deal with links. attr_reader :links def links=(value) + value = value.to_sym value = :manage if value == :ignore raise(ArgumentError, ":links can only be set to :manage or :follow") unless [:manage, :follow].include?(value) @links = value diff --git a/lib/puppet/file_serving/fileset.rb b/lib/puppet/file_serving/fileset.rb index b28fb2d7e..caad1b319 100644 --- a/lib/puppet/file_serving/fileset.rb +++ b/lib/puppet/file_serving/fileset.rb @@ -64,7 +64,7 @@ class Puppet::FileServing::Fileset end def links=(links) - links = links.intern if links.is_a?(String) + links = links.to_sym raise(ArgumentError, "Invalid :links value '%s'" % links) unless [:manage, :follow].include?(links) @links = links @stat_method = links == :manage ? :lstat : :stat diff --git a/spec/integration/indirector/rest.rb b/spec/integration/indirector/rest.rb index 1adbdac61..cfaaa5027 100755 --- a/spec/integration/indirector/rest.rb +++ b/spec/integration/indirector/rest.rb @@ -94,7 +94,7 @@ describe Puppet::Indirector::REST do end it "should pass options all the way through" do - @mock_model.expects(:find).with { |key, args| args["one"] == "two" and args["three"] == "four" }.returns @model_instance + @mock_model.expects(:find).with { |key, args| args[:one] == "two" and args[:three] == "four" }.returns @model_instance Puppet::TestIndirectedFoo.find('bar', :one => "two", :three => "four") end @@ -159,7 +159,7 @@ describe Puppet::Indirector::REST do end it "should pass options all the way through" do - @mock_model.expects(:search).with { |key, args| args["one"] == "two" and args["three"] == "four" }.returns @model_instances + @mock_model.expects(:search).with { |key, args| args[:one] == "two" and args[:three] == "four" }.returns @model_instances Puppet::TestIndirectedFoo.search("foo", :one => "two", :three => "four") end @@ -328,7 +328,7 @@ describe Puppet::Indirector::REST do end it "should pass options all the way through" do - @mock_model.expects(:find).with { |key, args| args["one"] == "two" and args["three"] == "four" }.returns @model_instance + @mock_model.expects(:find).with { |key, args| args[:one] == "two" and args[:three] == "four" }.returns @model_instance Puppet::TestIndirectedFoo.find('bar', :one => "two", :three => "four") end @@ -390,7 +390,7 @@ describe Puppet::Indirector::REST do end it "should pass options all the way through" do - @mock_model.expects(:search).with { |key, args| args["one"] == "two" and args["three"] == "four" }.returns @model_instances + @mock_model.expects(:search).with { |key, args| args[:one] == "two" and args[:three] == "four" }.returns @model_instances Puppet::TestIndirectedFoo.search('bar', :one => "two", :three => "four") end diff --git a/spec/unit/file_serving/base.rb b/spec/unit/file_serving/base.rb index 4eb62b038..de7ea4756 100755 --- a/spec/unit/file_serving/base.rb +++ b/spec/unit/file_serving/base.rb @@ -31,6 +31,10 @@ describe Puppet::FileServing::Base do proc { Puppet::FileServing::Base.new("/module/dir/file", :links => :else) }.should raise_error(ArgumentError) end + it "should allow links values to be set as strings" do + Puppet::FileServing::Base.new("/module/dir/file", :links => "follow").links.should == :follow + end + it "should default to :manage for :links" do Puppet::FileServing::Base.new("/module/dir/file").links.should == :manage end |