diff options
author | Tim Smith <tsmith@chef.io> | 2018-04-30 09:25:03 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-04-30 09:25:03 -0700 |
commit | 1e8d310fe93e6ebcc6b40f76e2ad754701051d0a (patch) | |
tree | b321413e9d9a7e2ab1b40660e1ecea9c8dbeeb39 | |
parent | 3ac7383d286f0aba074f1062530c107fd73e6db4 (diff) | |
download | chef-1e8d310fe93e6ebcc6b40f76e2ad754701051d0a.tar.gz |
Fix source property to use the name_property not name
Source was building off name not path, which means the name _property never actually worked. I modified an existing test to check this.
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/resource/remote_directory.rb | 2 | ||||
-rw-r--r-- | spec/unit/resource/remote_directory_spec.rb | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/chef/resource/remote_directory.rb b/lib/chef/resource/remote_directory.rb index fdafb4c8f4..14e4f4a497 100644 --- a/lib/chef/resource/remote_directory.rb +++ b/lib/chef/resource/remote_directory.rb @@ -53,7 +53,7 @@ class Chef rights_attribute(:files_rights) end - property :source, String, default: lazy { ::File.basename(name) } + property :source, String, default: lazy { ::File.basename(path) } property :files_backup, [ Integer, FalseClass ], default: 5, desired_state: false property :purge, [ TrueClass, FalseClass ], default: false, desired_state: false property :overwrite, [ TrueClass, FalseClass ], default: false diff --git a/spec/unit/resource/remote_directory_spec.rb b/spec/unit/resource/remote_directory_spec.rb index d9cef7edd9..8ec2d80bc8 100644 --- a/spec/unit/resource/remote_directory_spec.rb +++ b/spec/unit/resource/remote_directory_spec.rb @@ -32,7 +32,8 @@ describe Chef::Resource::RemoteDirectory do end it "has the basename of the remote directory resource as the default source" do - expect(resource.source).to eql("dunk") + resource.path "/foo/bar" + expect(resource.source).to eql("bar") end it "accepts a number for the remote files backup" do |