core: Add spec for running environment hooks with a custom Action::Runner
This commit is contained in:
parent
bbe7b3ffc5
commit
a0c1cc0231
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue