Add test for validating box metadata.json

This commit is contained in:
sophia 2022-09-14 14:05:27 -04:00
parent ccc232914d
commit 115bec2b05

View File

@ -44,6 +44,19 @@ describe Vagrant::Box, :skip_windows do
f.write(JSON.generate(data))
end
# Verify the metadata
expect { subject.metadata }.
to raise_error(Vagrant::Errors::BoxMetadataMissingRequiredFields)
end
it "provides the metadata associated with a box" do
data = { "provider" => "bar" }
# Write the metadata
directory.join("metadata.json").open("w") do |f|
f.write(JSON.generate(data))
end
# Verify the metadata
expect(subject.metadata).to eq(data)
end