Ensure env cleanup always happen in CLI#run
This commit is contained in:
parent
cacfa7e342
commit
7e3d753d5c
@ -45,6 +45,7 @@ module Producer
|
||||
|
||||
def run(worker: Worker.new(@env))
|
||||
evaluate_recipes.each { |recipe| worker.process recipe.tasks }
|
||||
ensure
|
||||
@env.cleanup
|
||||
end
|
||||
|
||||
|
@ -152,6 +152,15 @@ module Producer::Core
|
||||
expect(cli.env).to receive :cleanup
|
||||
cli.run
|
||||
end
|
||||
|
||||
context 'on error' do
|
||||
let(:recipe_file) { fixture_path_for 'recipes/raise.rb' }
|
||||
|
||||
it 'cleans up the env' do
|
||||
expect(cli.env).to receive :cleanup
|
||||
cli.run rescue nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#evaluate_recipes' do
|
||||
|
Loading…
x
Reference in New Issue
Block a user