diff options
author | Serdar Sutay <serdar@opscode.com> | 2014-12-11 16:24:29 -0800 |
---|---|---|
committer | Serdar Sutay <serdar@opscode.com> | 2014-12-11 16:24:29 -0800 |
commit | da59a45b758793562babf871a9aedb1cd51726fd (patch) | |
tree | f1ca8deb23a0c8f50ef418bbc8c2bce0a89fed39 /spec/functional/resource | |
parent | 16b1b5f977f6858d914d5b1fe748b4d6a4cff7f4 (diff) | |
download | chef-da59a45b758793562babf871a9aedb1cd51726fd.tar.gz |
Revert "Merge pull request #1901 from opscode/dont-prepend-to-relative-paths"
This reverts commit 1241ea6f9866d0e61d11129bb32e5fc96cd2bac0, reversing
changes made to 34d956c6b96087e6ca4bfbc9080037ded481709d.
Conflicts:
spec/functional/resource/file_spec.rb
spec/functional/resource/link_spec.rb
spec/unit/provider/link_spec.rb
Diffstat (limited to 'spec/functional/resource')
-rw-r--r-- | spec/functional/resource/link_spec.rb | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb index b4c6412e5d..209002b400 100644 --- a/spec/functional/resource/link_spec.rb +++ b/spec/functional/resource/link_spec.rb @@ -72,8 +72,8 @@ describe Chef::Resource::Link do end end - def paths_eql?(path1, path2) - Chef::Util::PathHelper.paths_eql?(path1, path2) + def canonicalize(path) + windows? ? path.gsub('/', '\\') : path end def symlink(a, b) @@ -180,7 +180,7 @@ describe Chef::Resource::Link do it 'links to the target file' do expect(symlink?(target_file)).to be_truthy - expect(paths_eql?(readlink(target_file), to)).to be_truthy + expect(readlink(target_file)).to eq(canonicalize(to)) end it 'marks the resource updated' do expect(resource).to be_updated @@ -201,7 +201,7 @@ describe Chef::Resource::Link do it 'leaves the file linked' do expect(symlink?(target_file)).to be_truthy - expect(paths_eql?(readlink(target_file), to)).to be_truthy + expect(readlink(target_file)).to eq(canonicalize(to)) end it 'does not mark the resource updated' do expect(resource).not_to be_updated @@ -279,7 +279,7 @@ describe Chef::Resource::Link do before(:each) do symlink(to, target_file) expect(symlink?(target_file)).to be_truthy - expect(paths_eql?(readlink(target_file), to)).to be_truthy + expect(readlink(target_file)).to eq(canonicalize(to)) end include_context 'create symbolic link is noop' include_context 'delete succeeds' @@ -294,7 +294,7 @@ describe Chef::Resource::Link do File.open(@other_target, 'w') { |file| file.write('eek') } symlink(@other_target, target_file) expect(symlink?(target_file)).to be_truthy - expect(paths_eql?(readlink(target_file), @other_target)).to be_truthy + expect(readlink(target_file)).to eq(canonicalize(@other_target)) end after(:each) do File.delete(@other_target) @@ -311,7 +311,7 @@ describe Chef::Resource::Link do nonexistent = File.join(test_file_dir, make_tmpname('nonexistent_spec')) symlink(nonexistent, target_file) expect(symlink?(target_file)).to be_truthy - expect(paths_eql?(readlink(target_file), nonexistent)).to be_truthy + expect(readlink(target_file)).to eq(canonicalize(nonexistent)) end include_context 'create symbolic link succeeds' include_context 'delete succeeds' @@ -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(paths_eql?(readlink(to), @other_target)).to be_truthy + expect(readlink(target_file)).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(paths_eql?(readlink(to), @other_target)).to be_truthy + expect(readlink(target_file)).to eq(canonicalize(@other_target)) end context 'and the link does not yet exist' do include_context 'create symbolic link succeeds' @@ -441,7 +441,7 @@ describe Chef::Resource::Link do before(:each) do symlink(to, target_file) expect(symlink?(target_file)).to be_truthy - expect(paths_eql?(readlink(target_file), to)).to be_truthy + expect(readlink(target_file)).to eq(canonicalize(to)) end include_context 'create symbolic link is noop' include_context 'delete succeeds' @@ -450,7 +450,7 @@ describe Chef::Resource::Link do before(:each) do symlink(absolute_to, target_file) expect(symlink?(target_file)).to be_truthy - expect(paths_eql?(readlink(target_file), absolute_to)).to be_truthy + expect(readlink(target_file)).to eq(canonicalize(absolute_to)) end include_context 'create symbolic link succeeds' include_context 'delete succeeds' @@ -478,7 +478,7 @@ describe Chef::Resource::Link do before(:each) do symlink(to, target_file) expect(symlink?(target_file)).to be_truthy - expect(paths_eql?(readlink(target_file), to)).to be_truthy + expect(readlink(target_file)).to eq(canonicalize(to)) end include_context 'create hard link succeeds' it_behaves_like 'delete errors out' @@ -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(paths_eql?(readlink(to), @other_target)).to be_truthy + expect(readlink(target_file)).to eq(canonicalize(@other_target)) end after(:each) do File.delete(@other_target) @@ -564,7 +564,7 @@ describe Chef::Resource::Link do # OS X gets angry about this sort of link. Bug in OS X, IMO. pending('OS X/FreeBSD/AIX symlink? and readlink working on hard links to symlinks') if (os_x? or freebsd? or aix?) expect(symlink?(target_file)).to be_truthy - expect(paths_eql?(readlink(target_file), @other_target)).to be_truthy + expect(readlink(target_file)).to eq(canonicalize(@other_target)) end include_context 'delete is noop' end @@ -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(paths_eql?(readlink(to), @other_target)).to be_truthy + expect(readlink(target_file)).to eq(canonicalize(@other_target)) end context 'and the link does not yet exist' do it 'links to the target file' do @@ -587,7 +587,7 @@ describe Chef::Resource::Link do expect(File.exists?(target_file)).to be_falsey end expect(symlink?(target_file)).to be_truthy - expect(paths_eql?(readlink(target_file), @other_target)).to be_truthy + expect(readlink(target_file)).to eq(canonicalize(@other_target)) end include_context 'delete is noop' end |