Sha256: 8c3961a361989f9a744458e54263d3fd7e7be4f94ceba15e7e3daaf89bd3b7e6

Contents?: true

Size: 1.57 KB

Versions: 7

Compression:

Stored size: 1.57 KB

Contents

require 'spec_helper'
require 'slop'

module Flydata
  module Command
    describe Sender do
      let(:opts) do
        slop = Sender.slop_start
        slop.parse(args)
        slop
      end
      subject { Sender.new(opts) }
      describe '#start' do
        before(:each) do
          allow(subject).to receive(:process_exist?).and_return(false)
          expect(subject).to receive(:wait_until_server_ready)
          expect(subject).to receive(:wait_until_client_ready)
          allow(Kernel).to receive(:sleep)
        end
        context "as daemon" do
          let(:args) { [] }
          it "starts fluend with daemon option" do
            expect(Kernel).to receive(:system).with( Regexp.new(
"fluentd -d .+/flydata.pid -l .+/flydata.log -c .+/flydata.conf -p .+/\.\./fluent-plugins"))
            subject.start(false)
          end
        end
        context "as regular process" do
          let(:args) { ["-n"] }
          it "starts fluentd with no daemon option" do
            expect(Kernel).to receive(:system).with(Regexp.new(
"fluentd  -l .+/flydata.log -c .+/flydata.conf -p .+/\.\./fluent-plugins"))
            subject.start(false)
          end
        end
        context "as regular process with long option" do
          let(:args) { ["--no-daemon"] }
          it "starts fluentd with no daemon option" do
            expect(Kernel).to receive(:system).with(Regexp.new(
"fluentd  -l .+/flydata.log -c .+/flydata.conf -p .+/\.\./fluent-plugins"))
            subject.start(false)
          end
        end
      end
      skip '#stop'
      skip '#restart'
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
flydata-0.2.1 spec/flydata/command/sender_spec.rb
flydata-0.2.0 spec/flydata/command/sender_spec.rb
flydata-0.1.15 spec/flydata/command/sender_spec.rb
flydata-0.1.13 spec/flydata/command/sender_spec.rb
flydata-0.1.12 spec/flydata/command/sender_spec.rb
flydata-0.1.11 spec/flydata/command/sender_spec.rb
flydata-0.1.10 spec/flydata/command/sender_spec.rb