Sha256: 59f263b37557f36b2a5ccf3f35ace02c1130dd0f9d6ae747fa8ae5f10ca0ba0e

Contents?: true

Size: 1.28 KB

Versions: 1

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_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.4 spec/fluent/format/check_spec.rb