Ensure size param is set for a disk
This commit is contained in:
parent
18b9ccd0a5
commit
66fe2e2854
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user