diff options
author | Claire McQuin <claire@getchef.com> | 2014-09-24 10:54:47 -0700 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-09-24 10:54:47 -0700 |
commit | f7407baf9df38f5f2f58e1e676e710411fb49f7b (patch) | |
tree | fd239a84f992eb9c9fb52d80e40198176e52378b /spec/unit/util | |
parent | 2d6d41d9b2465d3bc1e9f11b6d1197500f8859cc (diff) | |
download | chef-f7407baf9df38f5f2f58e1e676e710411fb49f7b.tar.gz |
Add spec for escape_glob with multiple path parts.
Diffstat (limited to 'spec/unit/util')
-rw-r--r-- | spec/unit/util/path_helper_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/util/path_helper_spec.rb b/spec/unit/util/path_helper_spec.rb index 26bdf3ad91..1d97efc607 100644 --- a/spec/unit/util/path_helper_spec.rb +++ b/spec/unit/util/path_helper_spec.rb @@ -223,5 +223,19 @@ describe Chef::Util::PathHelper do escaped_path = "C:\\\\this\\\\\\*path\\\\\\[needs\\]\\\\escaping\\?" expect(PathHelper.escape_glob(path)).to eq(escaped_path) end + + context "when given more than one argument" do + it "joins, cleanpaths, and escapes characters reserved by glob" do + args = ["this/*path", "[needs]", "escaping?"] + escaped_path = if windows? + "this\\\\\\*path\\\\\\[needs\\]\\\\escaping\\?" + else + "this/\\*path/\\[needs\\]/escaping\\?" + end + expect(PathHelper).to receive(:join).with(*args).and_call_original + expect(PathHelper).to receive(:cleanpath).and_call_original + expect(PathHelper.escape_glob(*args)).to eq(escaped_path) + end + end end end |