Action runner clears actions after execution
This commit is contained in:
parent
e4548508f2
commit
f1fc07e353
|
@ -38,13 +38,14 @@ module Vagrant
|
|||
|
||||
# Call the prepare method on each once its
|
||||
# initialized, then call the execute! method
|
||||
return_value = nil
|
||||
[:prepare, :execute!].each do |method|
|
||||
actions.each do |action|
|
||||
return_value = action.send(method)
|
||||
action.send(method)
|
||||
end
|
||||
end
|
||||
return_value
|
||||
|
||||
# Clear the actions
|
||||
actions.clear
|
||||
end
|
||||
|
||||
# Invokes an "around callback" which invokes before_name and
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
|
||||
|
||||
class ActionRunnerTest < Test::Unit::TestCase
|
||||
def mock_fake_action
|
||||
action = mock("action")
|
||||
action.stubs(:prepare)
|
||||
action.stubs(:execute!)
|
||||
action
|
||||
end
|
||||
|
||||
context "callbacks" do
|
||||
setup do
|
||||
@runner = Vagrant::Actions::Runner.new
|
||||
|
@ -104,6 +111,14 @@ class ActionRunnerTest < Test::Unit::TestCase
|
|||
@runner.execute!(run_class)
|
||||
end
|
||||
|
||||
should "clear actions after running execute!" do
|
||||
@runner.actions << mock_fake_action
|
||||
@runner.actions << mock_fake_action
|
||||
assert !@runner.actions.empty? # sanity
|
||||
@runner.execute!
|
||||
assert @runner.actions.empty?
|
||||
end
|
||||
|
||||
should "run #prepare on all actions, then #execute!" do
|
||||
action_seq = sequence("action_seq")
|
||||
actions = []
|
||||
|
|
Loading…
Reference in New Issue