Add Env#output with $stdout as default

This commit is contained in:
Thibault Jouan
2013-08-04 20:24:19 +00:00
parent e6c14f1903
commit 0cccbc8dde
2 changed files with 20 additions and 0 deletions

View File

@@ -13,6 +13,10 @@ module Producer::Core
it 'has no recipe' do
expect(env.current_recipe).not_to be
end
it 'assigns $stdout as the default output' do
expect(env.instance_eval { @output} ).to eq $stdout
end
end
context 'when a recipe is given as argument' do
@@ -25,6 +29,16 @@ module Producer::Core
end
end
describe '#output' do
let(:standard_output) { StringIO.new }
it 'writes the given string to the assigned IO with a record separator' do
env.output = standard_output
expect(standard_output).to receive(:puts).with('some content')
env.output 'some content'
end
end
describe '#target' do
let(:target) { Object.new }