From 2081fe56500438e4f4314a3187bce6c221917c90 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 28 Feb 2013 00:11:06 -0800 Subject: [PATCH] Tests passing for V1 config changes --- test/unit/vagrant/config/v1/loader_test.rb | 1 - test/unit/vagrant/config/v1/root_test.rb | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/test/unit/vagrant/config/v1/loader_test.rb b/test/unit/vagrant/config/v1/loader_test.rb index 653890154..02a5dd5ff 100644 --- a/test/unit/vagrant/config/v1/loader_test.rb +++ b/test/unit/vagrant/config/v1/loader_test.rb @@ -45,7 +45,6 @@ describe Vagrant::Config::V1::Loader do # Test that we have all keys result = described_class.init result.bar.should be_kind_of(OpenStruct) - expect { result.foo }.to raise_error(NoMethodError) end end diff --git a/test/unit/vagrant/config/v1/root_test.rb b/test/unit/vagrant/config/v1/root_test.rb index 55cd2880b..7c8e4061f 100644 --- a/test/unit/vagrant/config/v1/root_test.rb +++ b/test/unit/vagrant/config/v1/root_test.rb @@ -13,11 +13,6 @@ describe Vagrant::Config::V1::Root do 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" @@ -28,7 +23,18 @@ describe Vagrant::Config::V1::Root do instance = described_class.new(map) instance.__internal_state.should == { "config_map" => map, - "keys" => {} + "keys" => {}, + "missing_key_calls" => Set.new } end + + it "should record missing key calls" do + instance = described_class.new({}) + instance.foo.bar = false + + keys = instance.__internal_state["missing_key_calls"] + keys.should be_kind_of(Set) + keys.length.should == 1 + keys.include?("foo").should be + end end