Sha256: fefd5a2a87c39f8c91d542f9af18636ec9ff1ae217c3d5248b1d1c7a626956ac

Contents?: true

Size: 691 Bytes

Versions: 4

Compression:

Stored size: 691 Bytes

Contents

require 'spec_helper'

describe FluQ::Feed::Json do

  let(:buffer) { FluQ::Buffer::Base.new }
  let(:event)  { FluQ::Event.new("some.tag", 1313131313, "a" => "b") }

  before do
    io = StringIO.new [event, event, event].map(&:to_json).join("\n")
    buffer.stub(:drain).and_yield(io)
  end

  subject do
    described_class.new(buffer)
  end

  it { should be_a(FluQ::Feed::Base) }
  its(:to_a) { should == [event, event, event] }

  it 'should log invalid inputs' do
    io = StringIO.new [event.to_json, "ABCD", event.to_json].join("\n")
    buffer.stub(:drain).and_yield(io)
    subject.logger.should_receive(:warn).at_least(:once)
    subject.to_a.should == [event, event]
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fluq-0.7.5 spec/fluq/feed/json_spec.rb
fluq-0.7.3 spec/fluq/feed/json_spec.rb
fluq-0.7.1 spec/fluq/feed/json_spec.rb
fluq-0.7.0 spec/fluq/feed/json_spec.rb