diff --git a/lib/vagrant/actions/vm/provision.rb b/lib/vagrant/actions/vm/provision.rb index f712652d1..d2e07c8a1 100644 --- a/lib/vagrant/actions/vm/provision.rb +++ b/lib/vagrant/actions/vm/provision.rb @@ -32,7 +32,8 @@ module Vagrant @provisioner = provisioner_klass.new end - logger.info "Provisioning enabld with #{@provisioner.class}" + logger.info "Provisioning enabled with #{@provisioner.class}" + @provisioner.prepare end def execute! diff --git a/test/vagrant/actions/vm/provision_test.rb b/test/vagrant/actions/vm/provision_test.rb index 74cf5c95f..0cd863b18 100644 --- a/test/vagrant/actions/vm/provision_test.rb +++ b/test/vagrant/actions/vm/provision_test.rb @@ -44,6 +44,7 @@ class ProvisionActionTest < Test::Unit::TestCase setup do @instance = mock("instance") @instance.stubs(:is_a?).with(Vagrant::Provisioners::Base).returns(true) + @instance.stubs(:prepare) @klass = mock("klass") @klass.stubs(:is_a?).with(Class).returns(true) @klass.stubs(:new).returns(@instance) @@ -59,6 +60,11 @@ class ProvisionActionTest < Test::Unit::TestCase assert_equal @instance, @action.provisioner end + should "call prepare on the instance" do + @instance.expects(:prepare).once + @action.prepare + end + should "raise an exception if the class is not a subclass of the provisioner base" do @instance.expects(:is_a?).with(Vagrant::Provisioners::Base).returns(false) assert_raises(Vagrant::Actions::ActionException) { @@ -90,6 +96,14 @@ class ProvisionActionTest < Test::Unit::TestCase should "set :chef_solo to the ChefSolo provisioner" do provisioner_expectation(:chef_solo, Vagrant::Provisioners::ChefSolo) end + + should "call prepare on the instance" do + instance = mock("instance") + instance.expects(:prepare).once + instance.stubs(:is_a?).returns(true) + Vagrant::Provisioners::ChefSolo.expects(:new).returns(instance) + provisioner_expectation(:chef_solo, Vagrant::Provisioners::ChefSolo) + end end end end