summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2014-09-29 21:23:41 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2014-09-30 07:48:05 -0700
commitd0501369103574b7e99deb5636b232dda1f9adbc (patch)
tree54c459bfc27cc3bd34a7976a455c384cd6a842bb
parentd55a9e935fb084b5bb3f1770253d4c15e87ac010 (diff)
downloadchef-d0501369103574b7e99deb5636b232dda1f9adbc.tar.gz
Syntax checker uses helper method for relative path
Test pass on windows
-rw-r--r--lib/chef/cookbook/syntax_check.rb4
-rw-r--r--spec/unit/cookbook/syntax_check_spec.rb3
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/chef/cookbook/syntax_check.rb b/lib/chef/cookbook/syntax_check.rb
index 69c194516b..1437785259 100644
--- a/lib/chef/cookbook/syntax_check.rb
+++ b/lib/chef/cookbook/syntax_check.rb
@@ -103,9 +103,7 @@ class Chef
def remove_ignored_files(file_list)
return file_list unless chefignore.ignores.length > 0
file_list.reject do |full_path|
- cookbook_pn = Pathname.new cookbook_path
- full_pn = Pathname.new full_path
- relative_pn = full_pn.relative_path_from cookbook_pn
+ relative_pn = Chef::Util::PathHelper.relative_path_from(cookbook_path, full_path)
chefignore.ignored? relative_pn.to_s
end
end
diff --git a/spec/unit/cookbook/syntax_check_spec.rb b/spec/unit/cookbook/syntax_check_spec.rb
index b83bffe1c9..cd1ce96716 100644
--- a/spec/unit/cookbook/syntax_check_spec.rb
+++ b/spec/unit/cookbook/syntax_check_spec.rb
@@ -20,6 +20,9 @@ require 'spec_helper'
require "chef/cookbook/syntax_check"
describe Chef::Cookbook::SyntaxCheck do
+ before do
+ Chef::Platform.stub(:windows?) { false }
+ end
let(:cookbook_path) { File.join(CHEF_SPEC_DATA, 'cookbooks', 'openldap') }
let(:syntax_check) { Chef::Cookbook::SyntaxCheck.new(cookbook_path) }