From 3c8261f4ac22d66ed58d4c4f041d201594d0e262 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 9 Dec 2011 14:50:42 -0800 Subject: [PATCH] Add :ui to the globals for the action runner --- lib/vagrant/environment.rb | 2 +- test/unit/vagrant/environment_test.rb | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index ba1265f25..ae23a4644 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -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. diff --git a/test/unit/vagrant/environment_test.rb b/test/unit/vagrant/environment_test.rb index c56938a5f..2dd2dc7a0 100644 --- a/test/unit/vagrant/environment_test.rb +++ b/test/unit/vagrant/environment_test.rb @@ -44,16 +44,28 @@ describe Vagrant::Environment do collection.directory.should == instance.boxes_path end - it "has an action runner" do - instance.action_runner.should be_kind_of(Vagrant::Action::Runner) + 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 - it "has an action registry" do - instance.action_registry.should be_kind_of(Vagrant::Action::Registry) - end + describe "action registry" do + it "has an action registry" do + instance.action_registry.should be_kind_of(Vagrant::Action::Registry) + end - it "should have the built-in actions in the registry" do - instance.action_registry.get(:provision).should_not be_nil + 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