Sha256: d3bff96eba1e0e8b144295574633f33e34bb5d02b1db2b1b8fc2c6dd400628c9

Contents?: true

Size: 1.55 KB

Versions: 14

Compression:

Stored size: 1.55 KB

Contents

require "spec_helper"
require "logstash/environment"

describe LogStash::Environment do

  context "when loading jars dependencies" do

    let(:default_jars_location)    { File.join("vendor", "jar-dependencies") }
    let(:default_runtime_location) { File.join(default_jars_location,"runtime-jars","*.jar") }
    let(:default_test_location)    { File.join(default_jars_location,"test-jars","*.jar") }

    it "raises an exception if jruby is not available" do
      expect(subject).to receive(:jruby?).and_return(false)
      expect { subject.load_runtime_jars! }.to raise_error
    end

    it "find runtime jars in the default location" do
      expect(subject).to receive(:find_jars).with(default_runtime_location).and_return([])
      subject.load_runtime_jars!
    end

    it "find test jars in the default location" do
      expect(subject).to receive(:find_jars).with(default_test_location).and_return([])
      subject.load_test_jars!
    end

    context "when loading a jar file" do

      let(:dummy_jar_file) { File.join(default_jars_location,"runtime-jars","elasticsearch.jar") }

      it "requires the jar files if there are jars to load" do
        expect(subject).to receive(:find_jars).with(default_runtime_location).and_return([dummy_jar_file])
        expect(subject).to receive(:require).with(dummy_jar_file)
        subject.load_runtime_jars!
      end

      it "raises an exception if there are no jars to load" do
        allow(Dir).to receive(:glob).and_return([])
        expect { subject.load_runtime_jars! }.to raise_error
      end

    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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