Sha256: 5a2f83705fa64f46fe29c99f223097fb9b6239617e6254d711dfcd165d456e2c

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

describe Rake::Funnel::Integration::SyncOutput do
  context 'stream supports sync mode' do
    before do
      allow($stdout).to receive(:sync=)
      allow($stderr).to receive(:sync=)

      expect(subject).to be # rubocop:disable RSpec/ExpectInHook
    end

    it 'should immediately flush $stdout' do
      expect($stdout).to have_received(:sync=).with(true)
    end

    it 'should immediately flush $stderr' do
      expect($stderr).to have_received(:sync=).with(true)
    end
  end

  context 'stream does not support sync mode' do
    before do
      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 # rubocop:disable RSpec/ExpectInHook
    end

    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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rake-funnel-0.21.2 spec/rake/funnel/integration/sync_output_spec.rb
rake-funnel-0.21.1 spec/rake/funnel/integration/sync_output_spec.rb