Sha256: 71eee599e7e70e910c09e221fb73d0fff00e981287b5f3dcfc8cc70eba38c444

Contents?: true

Size: 945 Bytes

Versions: 4

Compression:

Stored size: 945 Bytes

Contents

require 'spec_helper'

describe FluQ::Input::Base do

  let(:event)    { FluQ::Event.new("some.tag", 1313131313, {}) }
  let!(:handler) { reactor.register FluQ::Handler::Test }
  subject        { described_class.new(reactor, feed: "json") }

  it { should be_a(FluQ::Mixins::Loggable) }
  its(:reactor) { should be(reactor) }
  its(:config)  { should == {feed: "json", buffer: "file", buffer_options: {}} }
  its(:name)    { should == "base" }
  its(:feed_klass) { should == FluQ::Feed::Json }
  its(:buffer_klass) { should == FluQ::Buffer::File }

  it 'should create new buffers' do
    (b1 = subject.new_buffer).should be_instance_of(FluQ::Buffer::File)
    (b2 = subject.new_buffer).should be_instance_of(FluQ::Buffer::File)
    b1.should_not be(b2)
  end

  it 'should flush buffers' do
    buf = subject.new_buffer
    buf.write [event, event].map(&:to_json).join("\n")
    subject.flush!(buf)
    handler.should have(2).events
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fluq-0.7.5 spec/fluq/input/base_spec.rb
fluq-0.7.3 spec/fluq/input/base_spec.rb
fluq-0.7.1 spec/fluq/input/base_spec.rb
fluq-0.7.0 spec/fluq/input/base_spec.rb