Unused config objects are finalized properly [GH-1877]
This commit is contained in:
parent
fc7c8b1e99
commit
7ef6c5d9d7
@ -65,6 +65,7 @@ BUG FIXES:
|
||||
works properly despite misconfigured sudoers. [GH-1307]
|
||||
- Synced folder paths on Windows containing '\' are replaced with
|
||||
'/' internally so that they work properly.
|
||||
- Unused config objects are finalized properly. [GH-1877]
|
||||
|
||||
## 1.2.4 (July 16, 2013)
|
||||
|
||||
|
||||
@ -40,6 +40,12 @@ module Vagrant
|
||||
# the Vagrant system. The "!" signifies that this is expected to
|
||||
# mutate itself.
|
||||
def finalize!
|
||||
@config_map.each do |key, klass|
|
||||
if !@keys.has_key?(key)
|
||||
@keys[key] = klass.new
|
||||
end
|
||||
end
|
||||
|
||||
@keys.each do |_key, instance|
|
||||
instance.finalize!
|
||||
end
|
||||
|
||||
@ -41,6 +41,24 @@ describe Vagrant::Config::V2::Root do
|
||||
}
|
||||
end
|
||||
|
||||
describe "finalization" do
|
||||
it "should finalize un-used keys" do
|
||||
foo_class = Class.new do
|
||||
attr_accessor :foo
|
||||
|
||||
def finalize!
|
||||
@foo = "SET"
|
||||
end
|
||||
end
|
||||
|
||||
map = { :foo => foo_class }
|
||||
instance = described_class.new(map)
|
||||
instance.finalize!
|
||||
|
||||
instance.foo.foo.should == "SET"
|
||||
end
|
||||
end
|
||||
|
||||
describe "validation" do
|
||||
let(:instance) do
|
||||
map = { :foo => Object, :bar => Object }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user