Sha256: 952201760b9c2ba485d0c4ad1c0892e92b7ac0234b0acd4baa01291d0562fa5f

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 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(Rake).to receive(:rake_output_message)
    end

    subject! { described_class.new }

    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.22.1 spec/rake/funnel/integration/sync_output_spec.rb
rake-funnel-0.22.0 spec/rake/funnel/integration/sync_output_spec.rb