Sha256: 8fa5d36c8c7443fc9c7853f327827095293b1b048961d0a945218b3752e46240

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe Fluent::Format::Check do
  let(:opts) {{
    :plugin_dirs => [File.expand_path('../../../example', File.dirname(__FILE__))],
    :libs => [File.expand_path('../../../example/out_example', File.dirname(__FILE__))] 
  }}
  let(:subject) { Fluent::Format.check(config, opts) }

  context "valid" do
    let(:config) { StringIO.new(%[<match>\ntype stdout\n</match>]) }
    it { should be_truthy }
  end

  context "plugin option" do
    let(:config) { StringIO.new(%[<match>\ntype example\n</match>]) }
    it { should be_truthy }
  end

  context "syntax error" do
    let(:config) { StringIO.new(%[<source>\ntype stdout\n</match>]) }
    it { expect { subject }.to raise_error(Fluent::ConfigParseError) }
  end

  context "plugin error" do
    let(:config) { StringIO.new(%[<match>\ntype foobar\n</match>]) }
    it { expect { subject }.to raise_error(Fluent::ConfigError) }
  end

  context "param error" do
    let(:config) { StringIO.new(%[<match>\ntype example\nparam bad\n</match>]) }
    it { expect { subject }.to raise_error(Fluent::ConfigError) }
  end

  context "file_path should `include`" do
    let(:config) { File.expand_path('../../../example/include_error.conf', File.dirname(__FILE__)) }
    it { expect { subject }.to raise_error(Fluent::ConfigError) }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fluent-format-0.3.0 spec/fluent/format/check_spec.rb
fluent-format-0.2.6 spec/fluent/format/check_spec.rb
fluent-format-0.2.5 spec/fluent/format/check_spec.rb