summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@chef.io>2016-02-24 17:38:33 -0800
committerdanielsdeleo <dan@chef.io>2016-02-26 17:42:30 -0800
commit63ce2e2e8abfc3a952ad16b53cac5e2e69176967 (patch)
treee616083ba557d34139181ad67b7effac4b05d986
parent6ee7814eeaf0d82b61b24eae0d43942304e6c7ea (diff)
downloadchef-63ce2e2e8abfc3a952ad16b53cac5e2e69176967.tar.gz
Add test file to fixture cookbook
-rw-r--r--spec/data/cookbooks/openldap/spec/spec_helper.rb0
-rw-r--r--spec/unit/cookbook/syntax_check_spec.rb6
-rw-r--r--spec/unit/cookbook_site_streaming_uploader_spec.rb4
3 files changed, 8 insertions, 2 deletions
diff --git a/spec/data/cookbooks/openldap/spec/spec_helper.rb b/spec/data/cookbooks/openldap/spec/spec_helper.rb
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/spec/data/cookbooks/openldap/spec/spec_helper.rb
diff --git a/spec/unit/cookbook/syntax_check_spec.rb b/spec/unit/cookbook/syntax_check_spec.rb
index 6d0ce96870..228f695106 100644
--- a/spec/unit/cookbook/syntax_check_spec.rb
+++ b/spec/unit/cookbook/syntax_check_spec.rb
@@ -38,7 +38,8 @@ describe Chef::Cookbook::SyntaxCheck do
recipes/default.rb
recipes/gigantor.rb
recipes/one.rb
- recipes/return.rb }.map { |f| File.join(cookbook_path, f) }
+ recipes/return.rb
+ spec/spec_helper.rb }.map { |f| File.join(cookbook_path, f) }
end
before do
@@ -50,7 +51,8 @@ describe Chef::Cookbook::SyntaxCheck do
@libr_files = %w{openldap.rb openldap/version.rb}.map { |f| File.join(cookbook_path, "libraries", f) }
@defn_files = %w{client.rb server.rb}.map { |f| File.join(cookbook_path, "definitions", f) }
@recipes = %w{default.rb gigantor.rb one.rb return.rb}.map { |f| File.join(cookbook_path, "recipes", f) }
- @ruby_files = @attr_files + @libr_files + @defn_files + @recipes + [File.join(cookbook_path, "metadata.rb")]
+ @spec_files = [ File.join(cookbook_path, "spec", "spec_helper.rb") ]
+ @ruby_files = @attr_files + @libr_files + @defn_files + @recipes + @spec_files + [File.join(cookbook_path, "metadata.rb")]
basenames = %w{ helpers_via_partial_test.erb
helper_test.erb
helpers.erb
diff --git a/spec/unit/cookbook_site_streaming_uploader_spec.rb b/spec/unit/cookbook_site_streaming_uploader_spec.rb
index 0e9c277b11..10963386dd 100644
--- a/spec/unit/cookbook_site_streaming_uploader_spec.rb
+++ b/spec/unit/cookbook_site_streaming_uploader_spec.rb
@@ -49,6 +49,10 @@ describe Chef::CookbookSiteStreamingUploader do
cookbook = @loader[:openldap]
files_count = Dir.glob(File.join(@cookbook_repo, cookbook.name.to_s, "**", "*"), File::FNM_DOTMATCH).count { |file| File.file?(file) }
+ # The fixture cookbook contains a spec/spec_helper.rb file, which is not
+ # a part of any cookbook segment, so it is not uploaded.
+ files_count -= 1
+
expect(Tempfile).to receive(:new).with("chef-#{cookbook.name}-build").and_return(FakeTempfile.new("chef-#{cookbook.name}-build"))
expect(FileUtils).to receive(:mkdir_p).exactly(files_count + 1).times
expect(FileUtils).to receive(:cp).exactly(files_count).times