Only run Environment#load! once
This commit is contained in:
parent
1478818939
commit
84389580d6
|
@ -206,11 +206,14 @@ module Vagrant
|
|||
# such as `vm`, `config`, etc. on this environment. The order this
|
||||
# method calls its other methods is very particular.
|
||||
def load!
|
||||
@loaded = true
|
||||
self.class.check_virtualbox!
|
||||
load_config!
|
||||
load_vm!
|
||||
actions.run(:environment_load)
|
||||
if !loaded?
|
||||
@loaded = true
|
||||
self.class.check_virtualbox!
|
||||
load_config!
|
||||
load_vm!
|
||||
actions.run(:environment_load)
|
||||
end
|
||||
|
||||
self
|
||||
end
|
||||
|
||||
|
|
|
@ -318,12 +318,13 @@ class EnvironmentTest < Test::Unit::TestCase
|
|||
|
||||
context "overall load method" do
|
||||
should "load! should call proper sequence and return itself" do
|
||||
env = @klass.new(:cwd => vagrantfile)
|
||||
call_seq = sequence("call_sequence")
|
||||
@klass.expects(:check_virtualbox!).once.in_sequence(call_seq)
|
||||
@env.expects(:load_config!).once.in_sequence(call_seq)
|
||||
@env.expects(:load_vm!).once.in_sequence(call_seq)
|
||||
@env.actions.expects(:run).with(:environment_load).once.in_sequence(call_seq)
|
||||
assert_equal @env, @env.load!
|
||||
env.expects(:load_config!).once.in_sequence(call_seq)
|
||||
env.expects(:load_vm!).once.in_sequence(call_seq)
|
||||
env.actions.expects(:run).with(:environment_load).once.in_sequence(call_seq)
|
||||
assert_equal env, env.load!
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue