Sha256: aed7e76ed61b8067087362d4d0d2a8c5bfb6e2fba5b5c06559ce65c72a915b3e

Contents?: true

Size: 1.31 KB

Versions: 5

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

describe Riddle::Configuration::TSVSource do
  it "should be invalid without an tsvpipe command, name and type if there's no parent" do
    source = Riddle::Configuration::TSVSource.new("tsv1")
    source.should_not be_valid

    source.tsvpipe_command = "ls /var/null"
    source.should be_valid

    source.name = nil
    source.should_not be_valid

    source.name = "tsv1"
    source.type = nil
    source.should_not be_valid
  end

  it "should be invalid without only a name and type if there is a parent" do
    source = Riddle::Configuration::TSVSource.new("tsv1")
    source.should_not be_valid

    source.parent = "tsvparent"
    source.should be_valid

    source.name = nil
    source.should_not be_valid

    source.name = "tsv1"
    source.type = nil
    source.should_not be_valid
  end

  it "should raise a ConfigurationError if rendering when not valid" do
    source = Riddle::Configuration::TSVSource.new("tsv1")
    lambda {
      source.render
    }.should raise_error(Riddle::Configuration::ConfigurationError)
  end

  it "should render correctly when valid" do
    source = Riddle::Configuration::TSVSource.new("tsv1")
    source.tsvpipe_command = "ls /var/null"

    source.render.should == <<-TSVSOURCE
source tsv1
{
  type = tsvpipe
  tsvpipe_command = ls /var/null
}
    TSVSOURCE
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
riddle-2.1.0 spec/unit/configuration/tsv_source_spec.rb
riddle-2.0.0 spec/unit/configuration/tsv_source_spec.rb
riddle-1.5.12 spec/unit/configuration/tsv_source_spec.rb
riddle-1.5.11 spec/unit/configuration/tsv_source_spec.rb
riddle-1.5.10 spec/unit/configuration/tsv_source_spec.rb