From de0865b9e248c26440fc64c4dd94d036ef0e3a82 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 11 Aug 2012 20:33:09 -0700 Subject: [PATCH] Test to ensure that the environment hash is returned from Machine#action This will allow methods that call into the action to use any results that might be set onto the environment hash by any of the middleware. --- test/unit/vagrant/machine_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/unit/vagrant/machine_test.rb b/test/unit/vagrant/machine_test.rb index eaf33ba2d..06275f31c 100644 --- a/test/unit/vagrant/machine_test.rb +++ b/test/unit/vagrant/machine_test.rb @@ -160,6 +160,16 @@ describe Vagrant::Machine do foo.should == :bar end + it "should return the environment as a result" do + action_name = :up + callable = lambda { |env| env[:result] = "FOO" } + + provider.stub(:action).with(action_name).and_return(callable) + result = instance.action(action_name) + + result[:result].should == "FOO" + end + it "should raise an exception if the action is not implemented" do action_name = :up