Sha256: b4a31f0cfda714fa5bba47dab293e733617b68a1d200aa8ea30dd690e73ed0e1

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 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
      pending '#stop'
      pending '#restart'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flydata-0.1.9 spec/flydata/command/sender_spec.rb