Ignore empty error groups
This commit is contained in:
parent
bae6555836
commit
a8b57ba13f
|
@ -55,8 +55,10 @@ module Vagrant
|
|||
result = instance.validate(env)
|
||||
if result && !result.empty?
|
||||
result.each do |key, value|
|
||||
errors[key] ||= []
|
||||
errors[key] += value
|
||||
if !value.empty?
|
||||
errors[key] ||= []
|
||||
errors[key] += value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -73,5 +73,16 @@ describe Vagrant::Config::V2::Root do
|
|||
|
||||
instance.validate(env).should == expected_errors
|
||||
end
|
||||
|
||||
it "shouldn't count empty keys" do
|
||||
errors = { "foo" => [] }
|
||||
env = { "errors" => errors }
|
||||
foo = instance.foo
|
||||
def foo.validate(env)
|
||||
env["errors"]
|
||||
end
|
||||
|
||||
instance.validate(env).should == {}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue