Sha256: 7f5626dd98f529a121aca2c4ad9820e06d8b2bb421ee105a2d18d9102331058b

Contents?: true

Size: 1.01 KB

Versions: 17

Compression:

Stored size: 1.01 KB

Contents

require "spec_helper"
require "logstash/runner"
require "stud/task"

class NullRunner
  def run(args); end
end

describe LogStash::Runner do

  context "argument parsing" do
    it "should run agent" do
      expect(Stud::Task).to receive(:new).once.and_return(nil)
      args = ["agent", "-e", ""]
      expect(subject.run(args)).to eq(nil)
    end

    it "should run agent help" do
      expect(subject).to receive(:show_help).once.and_return(nil)
      args = ["agent", "-h"]
      expect(subject.run(args).wait).to eq(0)
    end

    it "should show help with no arguments" do
      expect($stderr).to receive(:puts).once.and_return("No command given")
      expect($stderr).to receive(:puts).once
      args = []
      expect(subject.run(args).wait).to eq(1)
    end

    it "should show help for unknown commands" do
      expect($stderr).to receive(:puts).once.and_return("No such command welp")
      expect($stderr).to receive(:puts).once
      args = ["welp"]
      expect(subject.run(args).wait).to eq(1)
    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
logstash-core-1.5.4.snapshot2-java spec/core/runner_spec.rb
logstash-core-1.5.4.snapshot1-java spec/core/runner_spec.rb
logstash-core-1.5.3-java spec/core/runner_spec.rb
logstash-core-1.5.3.snapshot2-java spec/core/runner_spec.rb
logstash-core-1.5.3.snapshot1-java spec/core/runner_spec.rb
logstash-core-1.5.2.2-java spec/core/runner_spec.rb
logstash-core-1.5.2.1-java spec/core/runner_spec.rb
logstash-core-1.5.2-java spec/core/runner_spec.rb
logstash-core-1.5.2.snapshot2-java spec/core/runner_spec.rb
logstash-core-1.5.2.snapshot1-java spec/core/runner_spec.rb
logstash-core-1.5.1-java spec/core/runner_spec.rb
logstash-core-1.5.1.snapshot1-java spec/core/runner_spec.rb
logstash-core-1.5.0-java spec/core/runner_spec.rb
logstash-core-1.5.0.snapshot1-java spec/core/runner_spec.rb
logstash-core-1.5.0.rc4-java spec/core/runner_spec.rb
logstash-core-1.5.0.rc4.snapshot2-java spec/core/runner_spec.rb
logstash-core-1.5.0.rc4.snapshot1-java spec/core/runner_spec.rb