Sha256: 440ad0f21de3a649ea9395843c3ad5217dc9def72c2b5e3bde26b0ed6e9bebb0

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 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=)
    end

    subject! { described_class.new }

    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($stderr).to receive(:print)
    end

    subject! { described_class.new }

    it 'should log the error for $stdout' do
      expect($stderr).to have_received(:print).with(/Failed.*\$stdout/)
    end

    it 'should log the error for $stderr' do
      expect($stderr).to have_received(:print).with(/Failed.*\$stderr/)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rake-funnel-0.22.2 spec/rake/funnel/integration/sync_output_spec.rb