Add :ui to the globals for the action runner

This commit is contained in:
Mitchell Hashimoto 2011-12-09 14:50:42 -08:00
parent b31c3d458c
commit 3c8261f4ac
2 changed files with 20 additions and 8 deletions

View File

@ -209,7 +209,7 @@ module Vagrant
# #
# @return [Action::Runner] # @return [Action::Runner]
def action_runner def action_runner
@action_runner ||= Action::Runner.new(action_registry) @action_runner ||= Action::Runner.new(action_registry, :ui => @ui)
end end
# Action registry for registering new actions with this environment. # Action registry for registering new actions with this environment.

View File

@ -44,16 +44,28 @@ describe Vagrant::Environment do
collection.directory.should == instance.boxes_path collection.directory.should == instance.boxes_path
end end
it "has an action runner" do describe "action runner" do
instance.action_runner.should be_kind_of(Vagrant::Action::Runner) it "has an action runner" do
instance.action_runner.should be_kind_of(Vagrant::Action::Runner)
end
it "has a `ui` in the globals" do
result = nil
callable = lambda { |env| result = env[:ui] }
instance.action_runner.run(callable)
result.should eql(instance.ui)
end
end end
it "has an action registry" do describe "action registry" do
instance.action_registry.should be_kind_of(Vagrant::Action::Registry) it "has an action registry" do
end instance.action_registry.should be_kind_of(Vagrant::Action::Registry)
end
it "should have the built-in actions in the registry" do it "should have the built-in actions in the registry" do
instance.action_registry.get(:provision).should_not be_nil instance.action_registry.get(:provision).should_not be_nil
end
end end
describe "loading configuration" do describe "loading configuration" do