Ignore empty error groups

This commit is contained in:
Mitchell Hashimoto 2013-01-18 12:27:29 -08:00
parent bae6555836
commit a8b57ba13f
2 changed files with 15 additions and 2 deletions

View File

@ -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

View File

@ -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