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