spec/rake/funnel/integration/progress_report_spec.rb in rake-funnel-0.22.1 vs spec/rake/funnel/integration/progress_report_spec.rb in rake-funnel-0.22.2
- old
+ new
@@ -2,11 +2,11 @@
include Rake::DSL
let(:teamcity_running?) { false }
before do
- allow($stdout).to receive(:puts)
+ allow(subject).to receive(:print)
allow(Rake::Funnel::Integration::TeamCity).to receive(:running?).and_return(teamcity_running?)
Rake::Task.clear
end
@@ -25,19 +25,20 @@
Rake::Task[:task].invoke
end
context 'not on TeamCity' do
it 'should write colored task name in square brackets' do
- expect($stdout).to have_received(:puts).with("\n[task]".bold.cyan)
+ name = '[task]'.bold.cyan
+ expect(subject).to have_received(:print).with("\n#{name}\n")
end
end
context 'on TeamCity' do
let(:teamcity_running?) { true }
it 'should not write task name since it would clutter the output' do
- expect($stdout).not_to have_received(:puts).with(/task/)
+ expect(subject).not_to have_received(:print).with(/task/)
end
end
end
context 'when progess report was disabled' do
@@ -52,10 +53,10 @@
Rake::Task[:task].invoke
end
it 'should not write' do
- expect($stdout).not_to have_received(:puts).with("\n[task]")
+ expect(subject).not_to have_received(:print).with(/task/)
end
end
describe 'custom event handlers' do
let(:receiver) { double.as_null_object }