Sha256: 149004f51f0144266456c6f2748ca39b073a1de657aa54c7ae49f812a69296f7

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

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

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

  context "plugin option" do
    let(:config) { StringIO.new(%[<match>\ntype example\n</match>]) }
    it { should be_true }
  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

1 entries across 1 versions & 1 rubygems

Version Path
fluent-format-0.2.3 spec/fluent/format/check_spec.rb