Fix CLI#evaluate_recipe_file spec:

The spec wasn't covering the case when recipe evaluation raises an
unexpected error.
This commit is contained in:
Thibault Jouan 2013-08-06 19:38:33 +00:00
parent eaccf55581
commit bd1bdba9cf

View File

@ -80,6 +80,7 @@ module Producer::Core
let(:stdout) { StringIO.new }
subject(:cli) { CLI.new(arguments, stdout) }
context 'when error is known' do
it 'exits with a return status of 70' do
expect { cli.evaluate_recipe_file }
.to raise_error(SystemExit) { |e|
@ -102,6 +103,17 @@ module Producer::Core
expect(stdout.string).to_not match /\/producer-core\//
end
end
context 'when error is unknown (unexpected)' do
it 'lets the error be' do
UnexpectedError = Class.new(StandardError)
recipe = double('recipe')
allow(Recipe).to receive(:from_file).and_return(recipe)
allow(recipe).to receive(:evaluate).and_raise(UnexpectedError)
expect { cli.evaluate_recipe_file }.to raise_error(UnexpectedError)
end
end
end
end
end
end