Config class now properly uses class variables. Not sure how this one slipped through the cracks.

This commit is contained in:
Mitchell Hashimoto 2010-03-10 01:07:24 -08:00
parent 631580fc8e
commit 3daf48b70c
3 changed files with 7 additions and 9 deletions

View File

@ -4,21 +4,21 @@ module Vagrant
end
class Config
@config = nil
@config_runners = []
@@config = nil
@@config_runners = []
class << self
def reset!
@config = nil
@@config = nil
config_runners.clear
end
def config
@config ||= Config::Top.new
@@config ||= Config::Top.new
end
def config_runners
@config_runners ||= []
@@config_runners ||= []
end
def run(&block)

View File

@ -20,8 +20,7 @@ require 'mocha'
class Test::Unit::TestCase
# Clears the previous config and sets up the new config
def mock_config
Vagrant::Config.instance_variable_set(:@config_runners, nil)
Vagrant::Config.instance_variable_set(:@config, nil)
Vagrant::Config.reset!
Vagrant::Config.run do |config|
config.vagrant.dotfile_name = ".hobo"

View File

@ -38,8 +38,7 @@ class ConfigTest < Test::Unit::TestCase
context "initializing" do
teardown do
Vagrant::Config.instance_variable_set(:@config_runners, nil)
Vagrant::Config.instance_variable_set(:@config, nil)
Vagrant::Config.reset!
end
should "not run the blocks right away" do