diff options
author | Serdar Sutay <serdar@opscode.com> | 2014-12-11 16:43:46 -0800 |
---|---|---|
committer | Serdar Sutay <serdar@opscode.com> | 2014-12-11 16:43:46 -0800 |
commit | af20f1f996b58bef6972da92e3226135318c60cd (patch) | |
tree | 62e2aec02fc4588d1eca658a14aba458e5e20efc /spec | |
parent | da59a45b758793562babf871a9aedb1cd51726fd (diff) | |
download | chef-af20f1f996b58bef6972da92e3226135318c60cd.tar.gz |
As https://github.com/opscode/chef/issues/2580 summarizes, Link resource need to support relative paths in its 'to' attribute since one can create a symlink pointing to a relative location. This is useful if the directory that symlink resides in moves to a different place (e.g. mounting a disk on a separate location).sersut/revert-1901
This commit preserves relative paths inside the "encode_path" method used by the link operations and expands relative paths in similar fashion when being used by file operations.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/resource/link_spec.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb index 209002b400..d39a0c2ef6 100644 --- a/spec/functional/resource/link_spec.rb +++ b/spec/functional/resource/link_spec.rb @@ -393,7 +393,7 @@ describe Chef::Resource::Link do File.open(@other_target, "w") { |file| file.write("eek") } symlink(@other_target, to) expect(symlink?(to)).to be_truthy - expect(readlink(target_file)).to eq(canonicalize(@other_target)) + expect(readlink(to)).to eq(canonicalize(@other_target)) end after(:each) do File.delete(@other_target) @@ -408,7 +408,7 @@ describe Chef::Resource::Link do @other_target = File.join(test_file_dir, make_tmpname("other_spec")) symlink(@other_target, to) expect(symlink?(to)).to be_truthy - expect(readlink(target_file)).to eq(canonicalize(@other_target)) + expect(readlink(to)).to eq(canonicalize(@other_target)) end context 'and the link does not yet exist' do include_context 'create symbolic link succeeds' @@ -552,7 +552,7 @@ describe Chef::Resource::Link do File.open(@other_target, "w") { |file| file.write("eek") } symlink(@other_target, to) expect(symlink?(to)).to be_truthy - expect(readlink(target_file)).to eq(canonicalize(@other_target)) + expect(readlink(to)).to eq(canonicalize(@other_target)) end after(:each) do File.delete(@other_target) @@ -574,7 +574,7 @@ describe Chef::Resource::Link do @other_target = File.join(test_file_dir, make_tmpname("other_spec")) symlink(@other_target, to) expect(symlink?(to)).to be_truthy - expect(readlink(target_file)).to eq(canonicalize(@other_target)) + expect(readlink(to)).to eq(canonicalize(@other_target)) end context 'and the link does not yet exist' do it 'links to the target file' do |