summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/cookbook/synchronizer_spec.rb1
-rw-r--r--spec/unit/cookbook_manifest_spec.rb18
-rw-r--r--spec/unit/cookbook_uploader_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_show_spec.rb1
4 files changed, 14 insertions, 8 deletions
diff --git a/spec/unit/cookbook/synchronizer_spec.rb b/spec/unit/cookbook/synchronizer_spec.rb
index 77e64482da..e713b961c9 100644
--- a/spec/unit/cookbook/synchronizer_spec.rb
+++ b/spec/unit/cookbook/synchronizer_spec.rb
@@ -118,6 +118,7 @@ describe Chef::CookbookSynchronizer do
let(:synchronizer) do
Chef::Config[:no_lazy_load] = no_lazy_load
+ Chef::Config[:file_cache_path] = "/file-cache"
Chef::CookbookSynchronizer.new(cookbook_manifest, events)
end
diff --git a/spec/unit/cookbook_manifest_spec.rb b/spec/unit/cookbook_manifest_spec.rb
index a28eaff3d3..1ae471c15e 100644
--- a/spec/unit/cookbook_manifest_spec.rb
+++ b/spec/unit/cookbook_manifest_spec.rb
@@ -126,12 +126,13 @@ describe Chef::CookbookManifest do
relative_path
end
- {
+ Mash.new({
"name" => name,
"path" => relative_path,
- "checksum" => Chef::Digester.generate_md5_checksum_for_file(path),
"specificity" => "default",
- }.tap do |fp|
+ "checksum" => Chef::Digester.generate_md5_checksum_for_file(path),
+ "url" => nil,
+ }).tap do |fp|
if full
fp["full_path"] = path
end
@@ -168,14 +169,17 @@ describe Chef::CookbookManifest do
end
context ".each_file" do
+ let(:manifest_files) do
+ map_to_file_specs(all_files)
+ end
+
it "yields all the files" do
- files = map_to_file_specs(all_files, full: true)
- expect(cookbook_manifest.to_enum(:each_file)).to match_array(files)
+ expect(cookbook_manifest.to_enum(:each_file).map(&:to_hash)).to match_array(manifest_files)
end
it "excludes certain file parts" do
- files = map_to_file_specs(all_files, full: true).reject { |f| seg = f["name"].split("/")[0]; %w{ files templates }.include?(seg) }
- expect(cookbook_manifest.to_enum(:each_file, excluded_parts: %w{ files templates })).to match_array(files)
+ files = manifest_files.reject { |f| seg = f["name"].split("/")[0]; %w{ files templates }.include?(seg) }
+ expect(cookbook_manifest.to_enum(:each_file, excluded_parts: %w{ files templates }).map(&:to_hash)).to match_array(files)
end
end
end
diff --git a/spec/unit/cookbook_uploader_spec.rb b/spec/unit/cookbook_uploader_spec.rb
index e992c11ef7..4fb8e30e2e 100644
--- a/spec/unit/cookbook_uploader_spec.rb
+++ b/spec/unit/cookbook_uploader_spec.rb
@@ -101,7 +101,7 @@ describe Chef::CookbookUploader do
}
expect(http_client).to receive(:put).
- with(url_for(md5), IO.binread(file_path), upload_headers)
+ with(url_for(md5), IO.binread(file_path.full_path), upload_headers)
end
end
diff --git a/spec/unit/knife/cookbook_show_spec.rb b/spec/unit/knife/cookbook_show_spec.rb
index 1e8ea836d7..9848194754 100644
--- a/spec/unit/knife/cookbook_show_spec.rb
+++ b/spec/unit/knife/cookbook_show_spec.rb
@@ -130,6 +130,7 @@ describe Chef::Knife::CookbookShow do
[{ "name" => "recipes/default.rb",
"path" => "recipes/default.rb",
"checksum" => "1234",
+ "specificity" => nil,
"url" => "http://example.org/files/default.rb" }],
}
end