Ensure size param is set for a disk

This commit is contained in:
Brian Cain 2020-04-30 13:33:45 -07:00
parent 18b9ccd0a5
commit 66fe2e2854
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
2 changed files with 15 additions and 4 deletions

View File

@ -169,11 +169,12 @@ module VagrantPlugins
if @size.is_a?(String)
@size = Vagrant::Util::Numeric.string_to_bytes(@size)
end
end
if !@size
errors << I18n.t("vagrant.config.disk.invalid_size", name: @name, machine: machine.name)
end
end
if @file
if !@file.is_a?(String)

View File

@ -56,6 +56,16 @@ describe VagrantPlugins::Kernel_V2::VagrantConfigDisk do
end
end
describe "with an invalid config" do
let(:invalid_subject) { described_class.new(type) }
it "raises an error if size not set" do
invalid_subject.name = "bar"
subject.finalize!
assert_invalid
end
end
describe "defining a new config that needs to match internal restraints" do
before do
end