Sha256: da2668c4bbbc69626ed140fb049f2c687d76afbc1a747e488a3d2afd05d4e854

Contents?: true

Size: 704 Bytes

Versions: 2

Compression:

Stored size: 704 Bytes

Contents

require_relative 'spec_helper'

describe FileWatch::BufferedTokenizer do

  context "when using the default delimiter" do
    it "splits the lines correctly" do
      expect(subject.extract("hello\nworld\n")).to eq ["hello", "world"]
    end

    it "holds partial lines back until a token is found" do
      buffer = described_class.new
      expect(buffer.extract("hello\nwor")).to eq ["hello"]
      expect(buffer.extract("ld\n")).to eq ["world"]
    end
  end

  context "when passing a custom delimiter" do
    subject { FileWatch::BufferedTokenizer.new("\r\n") }

    it "splits the lines correctly" do
      expect(subject.extract("hello\r\nworld\r\n")).to eq ["hello", "world"]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logstash-input-file-4.1.1 spec/filewatch/buftok_spec.rb
logstash-input-file-4.1.0 spec/filewatch/buftok_spec.rb