spec/rake/funnel/tasks/timing_spec.rb in rake-funnel-0.22.1 vs spec/rake/funnel/tasks/timing_spec.rb in rake-funnel-0.22.2

- old
+ new

@@ -56,27 +56,25 @@ allow(Rake.application).to receive(:init) allow(Rake.application).to receive(:load_rakefile) Rake.application.top_level_tasks.unshift(:task) allow(Rake.application).to receive(:exit_because_of_exception) - allow($stdout).to receive(:puts) - allow(Kernel).to receive(:warn) - # The 'rake aborted!' message is #printed on $stderr. + allow($stdout).to receive(:print) allow($stderr).to receive(:print) Rake.application.run end context 'with task defined' do let(:define_tasks) do task :task do - puts 'hello' + $stdout.print 'hello' end end it 'should execute tasks' do - expect($stdout).to have_received(:puts).with('hello') + expect($stdout).to have_received(:print).with('hello') end it 'should record timing information for executed tasks' do expect(subject.stats).to have(2).items expect(subject.stats.first[:task].name).to eq('task') @@ -103,15 +101,15 @@ end describe 'build finished' do context 'when rake succeeded' do it 'should print the report' do - expect($stdout).to have_received(:puts).with(/Build time report/) + expect($stdout).to have_received(:print).with(/Build time report/) end it 'should report success' do - expect($stdout).to have_received(:puts).with(/Status\s+OK/) + expect($stdout).to have_received(:print).with(/Status\s+OK/) end end context 'when rake failed' do let(:define_tasks) do @@ -119,14 +117,14 @@ raise end end it 'should print the report' do - expect($stdout).to have_received(:puts).with(/Build time report/) + expect($stdout).to have_received(:print).with(/Build time report/) end it 'should report failure' do - expect(Kernel).to have_received(:warn).with(/Status\s+Failed/) + expect($stderr).to have_received(:print).with(/Status\s+Failed/) end end end end end