spec/rake/funnel/integration/sync_output_spec.rb in rake-funnel-0.10.0.pre vs spec/rake/funnel/integration/sync_output_spec.rb in rake-funnel-0.11.0.pre
- old
+ new
@@ -1,16 +1,37 @@
describe Rake::Funnel::Integration::SyncOutput do
- before {
- allow($stdout).to receive(:sync=)
- allow($stderr).to receive(:sync=)
+ context 'stream supports sync mode' do
+ before {
+ allow($stdout).to receive(:sync=)
+ allow($stderr).to receive(:sync=)
- expect(subject).to be
- }
+ expect(subject).to be
+ }
- it 'should immediately flush stdout' do
- expect($stdout).to have_received(:sync=).with(true)
+ it 'should immediately flush $stdout' do
+ expect($stdout).to have_received(:sync=).with(true)
+ end
+
+ it 'should immediately flush $stderr' do
+ expect($stdout).to have_received(:sync=).with(true)
+ end
end
- it 'should immediately flush stderr' do
- expect($stdout).to have_received(:sync=).with(true)
+ context 'stream does not support sync mode' do
+ before {
+ allow($stdout).to receive(:sync=).and_raise('$stdout.sync not supported')
+ allow($stderr).to receive(:sync=).and_raise('$stderr.sync not supported')
+
+ allow(Rake).to receive(:rake_output_message)
+
+ expect(subject).to be
+ }
+
+ it 'should log the error for $stdout' do
+ expect(Rake).to have_received(:rake_output_message).with(/Failed.*\$stdout/)
+ end
+
+ it 'should log the error for $stderr' do
+ expect(Rake).to have_received(:rake_output_message).with(/Failed.*\$stderr/)
+ end
end
end