Improve some context descriptions in specs

This commit is contained in:
Thibault Jouan 2013-07-31 22:45:42 +00:00
parent 0aa043b61a
commit a45a340b64
3 changed files with 6 additions and 6 deletions

View File

@ -77,7 +77,7 @@ module Producer::Core
cli.evaluate_recipe_file cli.evaluate_recipe_file
end end
context 'error during recipe evaluation' do context 'when recipe evaluation fails' do
let(:recipe_file) { fixture_path_for('recipes/invalid.rb') } let(:recipe_file) { fixture_path_for('recipes/invalid.rb') }
let(:stdout) { StringIO.new } let(:stdout) { StringIO.new }
subject(:cli) { CLI.new(arguments, stdout) } subject(:cli) { CLI.new(arguments, stdout) }

View File

@ -36,7 +36,7 @@ module Producer::Core
expect(dsl.evaluate(env)).to eq dsl expect(dsl.evaluate(env)).to eq dsl
end end
context 'invalid recipe' do context 'when recipe is invalid' do
let(:filepath) { fixture_path_for 'recipes/error.rb' } let(:filepath) { fixture_path_for 'recipes/error.rb' }
let(:recipe) { Recipe.from_file(filepath) } let(:recipe) { Recipe.from_file(filepath) }
subject(:dsl) { Recipe::DSL.new File.read(filepath) } subject(:dsl) { Recipe::DSL.new File.read(filepath) }
@ -67,8 +67,8 @@ module Producer::Core
expect { dsl.evaluate(env) }.to raise_error(RuntimeError, 'error from recipe') expect { dsl.evaluate(env) }.to raise_error(RuntimeError, 'error from recipe')
end end
context 'invalid sourced recipe' do context 'when sourced recipe is invalid' do
it 'reports the sourced recipe file path in the error' do it 'reports its file path in the error' do
expect { dsl.evaluate(env) }.to raise_error(RuntimeError) { |e| expect { dsl.evaluate(env) }.to raise_error(RuntimeError) { |e|
expect(e.backtrace.first).to match /\A#{filepath}/ expect(e.backtrace.first).to match /\A#{filepath}/
} }

View File

@ -13,7 +13,7 @@ module Producer::Core
end end
describe '#condition' do describe '#condition' do
context 'condition is met (block evals to true)' do context 'when met (block evals to true)' do
let(:block) { Proc.new { let(:block) { Proc.new {
condition { true } condition { true }
raise 'error after condition' raise 'error after condition'
@ -24,7 +24,7 @@ module Producer::Core
end end
end end
context 'condition is not met (block evals to false)' do context 'when not met (block evals to false)' do
let(:block) { Proc.new { let(:block) { Proc.new {
condition { false } condition { false }
raise raise