Sha256: 83a2bb517a5d08ee4a81308356668fb54bf0f688d27ea203fe9a1e2bd1f52d28

Contents?: true

Size: 1.38 KB

Versions: 25

Compression:

Stored size: 1.38 KB

Contents

require 'spec/spec_helper'

describe Riddle::Configuration::XMLSource do
  it "should be invalid without an xmlpipe command, name and type if there's no parent" do
    source = Riddle::Configuration::XMLSource.new("xml1", "xmlpipe")
    source.should_not be_valid
    
    source.xmlpipe_command = "ls /var/null"
    source.should be_valid
    
    source.name = nil
    source.should_not be_valid
    
    source.name = "xml1"
    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::XMLSource.new("xml1", "xmlpipe")
    source.should_not be_valid
    
    source.parent = "xmlparent"
    source.should be_valid
    
    source.name = nil
    source.should_not be_valid
    
    source.name = "xml1"
    source.type = nil
    source.should_not be_valid
  end
  
  it "should raise a ConfigurationError if rendering when not valid" do
    source = Riddle::Configuration::XMLSource.new("xml1", "xmlpipe")
    lambda { source.render }.should raise_error(Riddle::Configuration::ConfigurationError)
  end
  
  it "should render correctly when valid" do
    source = Riddle::Configuration::XMLSource.new("xml1", "xmlpipe")
    source.xmlpipe_command = "ls /var/null"
    
    source.render.should == <<-XMLSOURCE
source xml1
{
  type = xmlpipe
  xmlpipe_command = ls /var/null
}
    XMLSOURCE
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
freelancing-god-riddle-0.9.8.1533.2 spec/unit/configuration/xml_source_spec.rb
freelancing-god-riddle-0.9.8.1533.3 spec/unit/configuration/xml_source_spec.rb
freelancing-god-riddle-0.9.8.1533.4 spec/unit/configuration/xml_source_spec.rb
freelancing-god-riddle-0.9.8.1533.5 spec/unit/configuration/xml_source_spec.rb
freelancing-god-riddle-0.9.8.1533.7 spec/unit/configuration/xml_source_spec.rb
freelancing-god-riddle-0.9.8.1533.8 spec/unit/configuration/xml_source_spec.rb
freelancing-god-riddle-0.9.8.1533.9 spec/unit/configuration/xml_source_spec.rb
riddle-1.2.2 spec/unit/configuration/xml_source_spec.rb
riddle-1.2.1 spec/unit/configuration/xml_source_spec.rb
riddle-1.2.0 spec/unit/configuration/xml_source_spec.rb
riddle-1.1.0 spec/unit/configuration/xml_source_spec.rb
riddle-1.0.12 spec/unit/configuration/xml_source_spec.rb
riddle-1.0.11 spec/unit/configuration/xml_source_spec.rb
riddle-1.0.10 spec/unit/configuration/xml_source_spec.rb
riddle-1.0.9 spec/unit/configuration/xml_source_spec.rb
riddle-1.0.8 spec/unit/configuration/xml_source_spec.rb
riddle-1.0.7 spec/unit/configuration/xml_source_spec.rb
riddle-1.0.6 spec/unit/configuration/xml_source_spec.rb
riddle-1.0.5 spec/unit/configuration/xml_source_spec.rb
riddle-1.0.4 spec/unit/configuration/xml_source_spec.rb