Sha256: 0fc4b35ff7af0e1f54a72dd4f0a20a08b98649e379b814fa06f9167426150a58

Contents?: true

Size: 691 Bytes

Versions: 4

Compression:

Stored size: 691 Bytes

Contents

require 'spec_helper'

describe FluQ::Feed::Msgpack 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_msgpack).join
    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_msgpack, "ABCD", event.to_msgpack].join
    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/msgpack_spec.rb
fluq-0.7.3 spec/fluq/feed/msgpack_spec.rb
fluq-0.7.1 spec/fluq/feed/msgpack_spec.rb
fluq-0.7.0 spec/fluq/feed/msgpack_spec.rb