Sha256: bf4244150022726f081ed1e94652d0e32819131e61a9da5e3a93223d5442bd44

Contents?: true

Size: 1.21 KB

Versions: 11

Compression:

Stored size: 1.21 KB

Contents

# encoding: utf-8
require "spec_helper"
require "logstash/util/defaults_printer"

describe LogStash::Util::DefaultsPrinter do
  shared_examples "a defaults printer" do
    it 'the .print method returns a defaults description' do
      expect(actual_block.call).to eq(expected)
    end
  end

  let(:workers)  { 1 }
  let(:expected) { "Default settings used: Filter workers: #{workers}" }
  let(:settings) { {} }

  describe 'class methods API' do
    let(:actual_block) do
      -> {described_class.print(settings)}
    end

    context 'when the settings hash is empty' do
      it_behaves_like "a defaults printer"
    end

    context 'when the settings hash has content' do
      let(:workers) { 42 }
      let(:settings) { {'filter-workers' => workers} }

      it_behaves_like "a defaults printer"
    end
  end

  describe 'instance method API' do
    let(:actual_block) do
      -> {described_class.new(settings).print}
    end

    context 'when the settings hash is empty' do
      it_behaves_like "a defaults printer"
    end

    context 'when the settings hash has content' do
      let(:workers) { 13 }
      let(:settings) { {'filter-workers' => workers} }

      it_behaves_like "a defaults printer"
    end
  end
end

Version data entries

11 entries across 10 versions & 2 rubygems

Version Path
logstash-input-beats-2.0.2 vendor/jruby/1.9/gems/logstash-core-2.0.1-java/spec/util/defaults_printer_spec.rb
logstash-input-beats-2.0.2 vendor/jruby/1.9/gems/logstash-core-2.0.0-java/spec/util/defaults_printer_spec.rb
logstash-core-2.0.1-java spec/util/defaults_printer_spec.rb
logstash-core-2.1.0.snapshot1-java spec/util/defaults_printer_spec.rb
logstash-core-2.0.1.snapshot1-java spec/util/defaults_printer_spec.rb
logstash-core-2.0.0-java spec/util/defaults_printer_spec.rb
logstash-core-2.0.0.rc1-java spec/util/defaults_printer_spec.rb
logstash-input-beats-0.9.2 vendor/jruby/1.9/gems/logstash-core-2.0.0.beta3-java/spec/util/defaults_printer_spec.rb
logstash-input-beats-0.9.1 vendor/jruby/1.9/gems/logstash-core-2.0.0.beta3-java/spec/util/defaults_printer_spec.rb
logstash-core-2.0.0.beta3-java spec/util/defaults_printer_spec.rb
logstash-core-2.0.0.beta2-java spec/util/defaults_printer_spec.rb