diff options
author | John Keiser <jkeiser@opscode.com> | 2014-08-29 12:30:29 -0700 |
---|---|---|
committer | Adam Edwards <adamed@opscode.com> | 2014-08-30 12:31:10 -0700 |
commit | 4c54fc8719cb66db3a1314c7f6620e01dfd3462f (patch) | |
tree | e6b9ba6471549b14419406a0f14d624699847f99 /spec/unit/util | |
parent | bc3d6871086721d2049bd2e28e8801d0eed176ff (diff) | |
download | chef-4c54fc8719cb66db3a1314c7f6620e01dfd3462f.tar.gz |
Make join work properly with leading slashes
Diffstat (limited to 'spec/unit/util')
-rw-r--r-- | spec/unit/util/path_helper_spec.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/spec/unit/util/path_helper_spec.rb b/spec/unit/util/path_helper_spec.rb index eb89aa083a..57774c5b53 100644 --- a/spec/unit/util/path_helper_spec.rb +++ b/spec/unit/util/path_helper_spec.rb @@ -35,6 +35,12 @@ describe Chef::Util::PathHelper do PathHelper.join(is_windows ? 'C:\\foo\\' : "/foo/", "bar", "baz").should == expected end + it "joins components when some end and start with separators" do + expected = PathHelper.cleanpath("/foo/bar/baz") + expected = "C:#{expected}" if is_windows + PathHelper.join(is_windows ? 'C:\\foo\\' : "/foo/", "bar/", "/baz").should == expected + end + it "joins components that don't end in separators" do expected = PathHelper.cleanpath("/foo/bar/baz") expected = "C:#{expected}" if is_windows @@ -51,8 +57,7 @@ describe Chef::Util::PathHelper do if is_windows it "joins components on Windows when some end with unix separators" do - expected = 'C:\\foo/bar\\baz' - PathHelper.join('C:\\foo/', "bar", "baz").should == expected + PathHelper.join('C:\\foo/', "bar", "baz").should == 'C:\\foo\\bar\\baz' end end end |