Implement basic task actions API:

* Add Action base class;
* Implement Task::DSL.define_action(keyword, klass);
* Add Task::DSL#actions accessor;
* Apply task DSL actions when Task instances are evaluated.
This commit is contained in:
Thibault Jouan
2013-08-03 14:45:14 +00:00
parent 8e455fc4d5
commit e6c14f1903
7 changed files with 92 additions and 3 deletions

View File

@@ -21,11 +21,20 @@ module Producer::Core
end
it 'evaluates the task DSL sandbox' do
dsl = double('task dsl')
dsl = double('task DSL').as_null_object
allow(Task::DSL).to receive(:new) { dsl }
expect(dsl).to receive(:evaluate).with(env)
task.evaluate(env)
end
it 'applies DSL sandbox actions' do
dsl = double('task DSL').as_null_object
allow(Task::DSL).to receive(:new) { dsl }
action = double('action')
allow(dsl).to receive(:actions) { [action] }
expect(action).to receive(:apply)
task.evaluate(env)
end
end
end
end