Implement Worker class:
* Move recipe processing code in the worker; * Refactor CLI and use the the worker; * Implement Recipe#tasks and remove tasks application during evaluation, tasks are now applied by the worker after all evaluations are done.
This commit is contained in:
@@ -24,6 +24,10 @@ module Producer::Core
|
||||
it 'assigns nil as a default filepath' do
|
||||
expect(recipe.filepath).to be nil
|
||||
end
|
||||
|
||||
it 'has no task' do
|
||||
expect(recipe.tasks).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
describe '#code' do
|
||||
@@ -64,6 +68,13 @@ module Producer::Core
|
||||
expect(task).to receive(:evaluate).with(env)
|
||||
recipe.evaluate(env)
|
||||
end
|
||||
|
||||
it 'assigns the evaluated tasks' do
|
||||
dsl = Recipe::DSL.new { task(:some_task) { } }
|
||||
allow(Recipe::DSL).to receive(:new) { dsl }
|
||||
recipe.evaluate(env)
|
||||
expect(recipe.tasks.first.name).to eq :some_task
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user