Mitchell Hashimoto 53860f90ab V2 loader now properly upgrades V1 configuration.
This is done by calling the `upgrade` method on the _old_ configuration
classes. The old configuration classes are given the complete new
configuration and can set whatever settings they need to on it.
2012-11-07 20:01:39 -08:00

35 lines
945 B
Ruby

require File.expand_path("../../../../base", __FILE__)
describe Vagrant::Config::V2::Root do
include_context "unit"
it "should provide access to config objects" do
foo_class = Class.new
map = { :foo => foo_class }
instance = described_class.new(map)
foo = instance.foo
foo.should be_kind_of(foo_class)
instance.foo.should eql(foo)
end
it "should raise a proper NoMethodError if a config key doesn't exist" do
instance = described_class.new({})
expect { instance.foo }.to raise_error(NoMethodError)
end
it "can be created with initial state" do
instance = described_class.new({}, { :foo => "bar" })
instance.foo.should == "bar"
end
it "should return internal state" do
map = { "foo" => Object, "bar" => Object }
instance = described_class.new(map)
instance.__internal_state.should == {
"config_map" => map,
"keys" => {}
}
end
end