From 6cfddb6c38a466412f054b75298f5bd130bb6186 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 10 Mar 2010 12:29:51 -0800 Subject: [PATCH] Tests to verify that the instance method exists for configs --- test/vagrant/config_test.rb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/vagrant/config_test.rb b/test/vagrant/config_test.rb index 41230d0d8..311296e3e 100644 --- a/test/vagrant/config_test.rb +++ b/test/vagrant/config_test.rb @@ -133,7 +133,6 @@ class ConfigTest < Test::Unit::TestCase setup do @configures_list = [] Vagrant::Config::Top.stubs(:configures_list).returns(@configures_list) - Vagrant::Config::Top.stubs(:attr_reader) end context "adding configure keys" do @@ -148,7 +147,11 @@ class ConfigTest < Test::Unit::TestCase end end - context "initializing" do + context "configuration keys on instance" do + setup do + @configures_list.clear + end + should "initialize each configurer and set it to its key" do 5.times do |i| key = "key#{i}" @@ -160,6 +163,17 @@ class ConfigTest < Test::Unit::TestCase Vagrant::Config::Top.new end + + should "allow reading via methods" do + key = "my_foo_bar_key" + klass = mock("klass") + instance = mock("instance") + klass.expects(:new).returns(instance) + Vagrant::Config::Top.configures(key, klass) + + config = Vagrant::Config::Top.new + assert_equal instance, config.send(key) + end end context "loaded status" do