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]
def action_runner
@action_runner ||= Action::Runner.new(action_registry)
@action_runner ||= Action::Runner.new(action_registry, :ui => @ui)
end
# Action registry for registering new actions with this environment.

View File

@ -44,10 +44,21 @@ describe Vagrant::Environment do
collection.directory.should == instance.boxes_path
end
describe "action runner" do
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
describe "action registry" do
it "has an action registry" do
instance.action_registry.should be_kind_of(Vagrant::Action::Registry)
end
@ -55,6 +66,7 @@ describe Vagrant::Environment do
it "should have the built-in actions in the registry" do
instance.action_registry.get(:provision).should_not be_nil
end
end
describe "loading configuration" do
it "should load global configuration" do