Enable verbose mode when PRODUCER_VERBOSE is set

This commit is contained in:
Thibault Jouan
2015-04-06 13:45:57 +00:00
parent cd389a3209
commit bd754f2bf6
4 changed files with 32 additions and 5 deletions

View File

@@ -8,15 +8,16 @@ module Producer::Core
let(:options) { [] }
let(:recipe_file) { fixture_path_for 'recipes/some_recipe.rb' }
let(:arguments) { [*options, recipe_file] }
let(:environment) { {} }
subject(:cli) { described_class.new(arguments) }
subject(:cli) { described_class.new(arguments, environment) }
describe '.run!' do
subject(:run!) { described_class.run! arguments }
it 'builds a new CLI instance with given arguments' do
it 'builds a new CLI instance with given arguments and environment' do
expect(described_class)
.to receive(:new).with(arguments, anything).and_call_original
.to receive(:new).with(arguments, ENV, anything).and_call_original
run!
end
@@ -75,6 +76,14 @@ module Producer::Core
it 'assigns CLI stderr as the env error output' do
expect(cli.env.error_output).to be cli.stderr
end
context 'when PRODUCER_VERBOSE environment variable is set' do
before { environment['PRODUCER_VERBOSE'] = 'yes' }
it 'enables env verbose mode' do
expect(cli.env).to be_verbose
end
end
end
describe '#parse_arguments!' do