Sha256: 3bf132ad093d346c493ad494bfd3fe07a571b1cb140a9a46b268e0b317880e24

Contents?: true

Size: 766 Bytes

Versions: 36

Compression:

Stored size: 766 Bytes

Contents

require 'logstash-logger'

describe LogStashLogger::Device::Stdout do
  let(:stdout) { $stdout }

  it "writes to $stdout" do
    expect(subject.to_io).to eq(stdout)
    expect(stdout).to receive(:write).once
    subject.write("test")
  end

  it "ignores #close" do
    expect(stdout).not_to receive(:close)
    subject.close
  end

  context "when the default $stdout has been overridden" do
    before { $stdout = StringIO.new }
    after  { $stdout = STDOUT }

    let(:injected_stdout) { STDOUT }

    subject { described_class.new(io: injected_stdout) }

    it "accepts an injectable reference to stdout" do
      expect(subject.to_io).to eq(injected_stdout)
      expect(injected_stdout).to receive(:write).once
      subject.write("test")
    end
  end
end

Version data entries

36 entries across 36 versions & 3 rubygems

Version Path
logstash-logger-p-0.26.1 spec/device/stdout_spec.rb
logstash-logger-yajl-0.27.0 spec/device/stdout_spec.rb
logstash-logger-0.26.1 spec/device/stdout_spec.rb
logstash-logger-0.26.0 spec/device/stdout_spec.rb
logstash-logger-0.25.1 spec/device/stdout_spec.rb
logstash-logger-0.25.0 spec/device/stdout_spec.rb
logstash-logger-0.24.1 spec/device/stdout_spec.rb
logstash-logger-0.24.0 spec/device/stdout_spec.rb
logstash-logger-0.23.0 spec/device/stdout_spec.rb
logstash-logger-0.22.1 spec/device/stdout_spec.rb
logstash-logger-0.22.0 spec/device/stdout_spec.rb
logstash-logger-0.21.0 spec/device/stdout_spec.rb
logstash-logger-0.20.1 spec/device/stdout_spec.rb
logstash-logger-0.20.0 spec/device/stdout_spec.rb
logstash-logger-0.19.2 spec/device/stdout_spec.rb
logstash-logger-0.19.1 spec/device/stdout_spec.rb
logstash-logger-0.19.0 spec/device/stdout_spec.rb
logstash-logger-0.18.1 spec/device/stdout_spec.rb
logstash-logger-0.18.0 spec/device/stdout_spec.rb
logstash-logger-0.17.0 spec/device/stdout_spec.rb