From 1de152ae3622455b608ab2edefe3f74771d9e1c7 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 6 Jul 2011 22:50:49 -0700 Subject: [PATCH] Move provisioning prepare up into the `call` method --- lib/vagrant/action/vm/provision.rb | 2 +- test/vagrant/action/vm/provision_test.rb | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/vagrant/action/vm/provision.rb b/lib/vagrant/action/vm/provision.rb index fb818c033..e61186199 100644 --- a/lib/vagrant/action/vm/provision.rb +++ b/lib/vagrant/action/vm/provision.rb @@ -15,6 +15,7 @@ module Vagrant enabled_provisioners.each do |instance| @env.ui.info I18n.t("vagrant.actions.vm.provision.beginning", :provisioner => instance.class) + instance.prepare instance.provision! end end @@ -22,7 +23,6 @@ module Vagrant def enabled_provisioners @env["config"].vm.provisioners.map do |provisioner| instance = provisioner.provisioner.new(@env, provisioner.config) - instance.prepare instance end end diff --git a/test/vagrant/action/vm/provision_test.rb b/test/vagrant/action/vm/provision_test.rb index d5e6d8664..665f9213a 100644 --- a/test/vagrant/action/vm/provision_test.rb +++ b/test/vagrant/action/vm/provision_test.rb @@ -23,10 +23,6 @@ class ProvisionVMActionTest < Test::Unit::TestCase end context "loading a provisioner" do - setup do - Vagrant::Provisioners::ChefSolo.any_instance.expects(:prepare).at_least(0) - end - should "instantiate and prepare each provisioner" do @env["config"].vm.provision :chef_solo @env["config"].vm.provision :chef_solo @@ -58,6 +54,7 @@ class ProvisionVMActionTest < Test::Unit::TestCase @app.expects(:call).with(@env).in_sequence(seq) @instance.stubs(:enabled_provisioners).returns(provisioners) provisioners.each do |prov| + prov.expects(:prepare).in_sequence(seq) prov.expects(:provision!).in_sequence(seq) end