core: Add spec for running environment hooks with a custom Action::Runner

This commit is contained in:
Fabio Rehm 2013-10-29 13:28:04 -02:00
parent bbe7b3ffc5
commit a0c1cc0231
2 changed files with 9 additions and 0 deletions

View File

@ -272,6 +272,7 @@ module Vagrant
# against the given name will be run in the context of this environment.
#
# @param [Symbol] name Name of the hook.
# @param [Action::Runner] action_runner A custom action runner for running hooks.
def hook(name, runner = action_runner)
@logger.info("Running hook: #{name}")
callable = Action::Builder.new

View File

@ -308,6 +308,14 @@ describe Vagrant::Environment do
instance.hook(:bar).should == :foo
end
it "should allow passing in a custom action runner" do
instance.action_runner.should_not_receive(:run)
other_runner = mock
other_runner.should_receive(:run).with(:bar).and_return(:foo)
instance.hook(:bar, other_runner).should == :foo
end
end
describe "primary machine name" do