Sha256: 1b882cf1a99e750e91888a9fa1dc286d50b6de255fd426ca59a652e8a2a41c35

Contents?: true

Size: 588 Bytes

Versions: 2

Compression:

Stored size: 588 Bytes

Contents

require 'spec_helper'

describe FluQ::Format::Json do

  let(:data) { %({"a":"b"}\n{"a":"b"}\n{"a":"b"}\n) }

  it { should be_a(FluQ::Format::Lines) }

  it 'should parse' do
    events = subject.parse(data)
    events.should have(3).items
    events.first.timestamp.should be_within(5).of(Time.now.to_i)
    events.first.should == FluQ::Event.new({"a" => "b"}, events.first.timestamp)
  end

  it 'should log invalid inputs' do
    subject.logger.should_receive(:warn).once
    events = subject.parse data + %(NOTJSON\n{"a":"b"}\n\n{"a":"b"})
    events.should have(5).items
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fluq-0.8.1 spec/fluq/format/json_spec.rb
fluq-0.8.0 spec/fluq/format/json_spec.rb