diff options
-rw-r--r-- | chef/lib/chef/resource/link.rb | 11 | ||||
-rw-r--r-- | chef/spec/unit/resource/link_spec.rb | 8 |
2 files changed, 19 insertions, 0 deletions
diff --git a/chef/lib/chef/resource/link.rb b/chef/lib/chef/resource/link.rb index a0c5726abc..33a30f428f 100644 --- a/chef/lib/chef/resource/link.rb +++ b/chef/lib/chef/resource/link.rb @@ -26,6 +26,17 @@ class Chef provides :link, :on_platform => :all + identity_attr :target_file + + state_attrs :link_type, :to + + state_attrs :owner, :group, :mode + + # By default, windows gets `state_attrs :rights, :deny_rights` + if Platform.windows? + state_attrs :rights, :deny_rights + end + def initialize(name, run_context=nil) super @resource_name = :link diff --git a/chef/spec/unit/resource/link_spec.rb b/chef/spec/unit/resource/link_spec.rb index b519303f9f..0a79506ebd 100644 --- a/chef/spec/unit/resource/link_spec.rb +++ b/chef/spec/unit/resource/link_spec.rb @@ -51,6 +51,14 @@ describe Chef::Resource::Link do @resource.target_file.should eql("fakey_fakerton") end + it "uses the target_file as the identity attribute" do + @resource.identity.should == "fakey_fakerton" + end + + it "has state attributes :link_type, :to, and permissions attributes" do + @resource.state.keys.should =~ [:owner, :mode, :group, :link_type, :to] + end + it "should accept a string as the link source via 'to'" do lambda { @resource.to "/tmp" }.should_not raise_error(ArgumentError) end |