diff options
Diffstat (limited to 'spec/unit/cookbook_manifest_spec.rb')
-rw-r--r-- | spec/unit/cookbook_manifest_spec.rb | 18 |
1 files changed, 11 insertions, 7 deletions
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 |