Sha256: 608d222b6c37fee02f60ded066c83c80f8f9bfbe213ab7d6643b9418cc12c1eb

Contents?: true

Size: 1.23 KB

Versions: 76

Compression:

Stored size: 1.23 KB

Contents

# encoding: utf-8
require "spec_helper"
require "logstash/settings"

describe LogStash::Setting::ArrayCoercible do
  subject { described_class.new("option", element_class, value) }
  let(:value) { [ ] }
  let(:element_class) { Object }

  context "when given a non array value" do
    let(:value) { "test" }
    describe "the value" do
      it "is converted to an array with that single element" do
        expect(subject.value).to eq(["test"])
      end
    end
  end

  context "when given an array value" do
    let(:value) { ["test"] }
    describe "the value" do
      it "is not modified" do
        expect(subject.value).to eq(value)
      end
    end
  end

  describe "initialization" do
    subject { described_class }
    let(:element_class) { Fixnum }
    context "when given values of incorrect element class" do
      let(:value) { "test" }

      it "will raise an exception" do
        expect { described_class.new("option", element_class, value) }.to raise_error(ArgumentError)
      end
    end
    context "when given values of correct element class" do
      let(:value) { 1 }

      it "will not raise an exception" do
        expect { described_class.new("option", element_class, value) }.not_to raise_error
      end
    end
  end
end

Version data entries

76 entries across 73 versions & 8 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/settings/array_coercible_spec.rb