Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions spec/filewatch/buftok_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@

context "when using the default delimiter" do
it "splits the lines correctly" do
expect(subject.extract("hello\nworld\n")).to eq ["hello", "world"]
expect(subject.extract("hello\nworld\n").to_a).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"]
expect(buffer.extract("hello\nwor").to_a).to eq ["hello"]
expect(buffer.extract("ld\n").to_a).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"]
expect(subject.extract("hello\r\nworld\r\n").to_a).to eq ["hello", "world"]
end
end
end