Add Env#output with $stdout as default
This commit is contained in:
@@ -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 }
|
||||
|
||||
|
Reference in New Issue
Block a user