summaryrefslogtreecommitdiff
path: root/spec/unit/cookbook/syntax_check_spec.rb
diff options
context:
space:
mode:
authorMatt Veitas <mveitas@gmail.com>2014-03-15 08:34:15 -0400
committerBryan McLellan <btm@getchef.com>2014-03-28 16:16:48 -0700
commit7595c07913139bc28eb360a9be05479f08247285 (patch)
tree2e26e2d0ee96001055ec8b984d90cd09b56d8d91 /spec/unit/cookbook/syntax_check_spec.rb
parent8f40a3d5ea3db77804852e48b187cf3ae85fc236 (diff)
downloadchef-7595c07913139bc28eb360a9be05479f08247285.tar.gz
Update the unit tests to use the files names instead of the number of files
Diffstat (limited to 'spec/unit/cookbook/syntax_check_spec.rb')
-rw-r--r--spec/unit/cookbook/syntax_check_spec.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/spec/unit/cookbook/syntax_check_spec.rb b/spec/unit/cookbook/syntax_check_spec.rb
index 190a7e1936..a674f6ab40 100644
--- a/spec/unit/cookbook/syntax_check_spec.rb
+++ b/spec/unit/cookbook/syntax_check_spec.rb
@@ -24,6 +24,17 @@ describe Chef::Cookbook::SyntaxCheck do
let(:cookbook_path) { File.join(CHEF_SPEC_DATA, 'cookbooks', 'openldap') }
let(:syntax_check) { Chef::Cookbook::SyntaxCheck.new(cookbook_path) }
+ let(:open_ldap_cookbook_files) {
+ %w{ attributes/default.rb
+ attributes/smokey.rb
+ definitions/client.rb
+ definitions/server.rb
+ metadata.rb
+ recipes/default.rb
+ recipes/gigantor.rb
+ recipes/one.rb }.map{ |f| File.join(cookbook_path, f) }
+}
+
before do
Chef::Log.logger = Logger.new(StringIO.new)
Chef::Log.level = :warn # suppress "Syntax OK" messages
@@ -47,13 +58,13 @@ describe Chef::Cookbook::SyntaxCheck do
Chef::Config[:cookbook_path] = File.dirname(cookbook_path)
syntax_check = Chef::Cookbook::SyntaxCheck.for_cookbook(:openldap)
syntax_check.cookbook_path.should == cookbook_path
- syntax_check.ruby_files.length.should == 8
+ syntax_check.ruby_files.sort.should == open_ldap_cookbook_files.sort
end
it "creates a syntax checker given the cookbook name and cookbook_path" do
syntax_check = Chef::Cookbook::SyntaxCheck.for_cookbook(:openldap, File.join(CHEF_SPEC_DATA, 'cookbooks'))
syntax_check.cookbook_path.should == cookbook_path
- syntax_check.ruby_files.length.should == 8
+ syntax_check.ruby_files.sort.should == open_ldap_cookbook_files.sort
end
context "when using a standalone cookbook" do
@@ -62,7 +73,7 @@ describe Chef::Cookbook::SyntaxCheck do
it "creates a syntax checker given the cookbook name and cookbook_path for a standalone cookbook" do
syntax_check = Chef::Cookbook::SyntaxCheck.for_cookbook(:standalone_cookbook, CHEF_SPEC_DATA)
syntax_check.cookbook_path.should == cookbook_path
- syntax_check.ruby_files.length.should == 1
+ syntax_check.ruby_files.should == [File.join(cookbook_path, 'recipes/default.rb')]
end
end