Sha256: 259d15163e96ec0220649147dbecf1a3b63c77f0ba97bacf4135d9bee7c33bc0

Contents?: true

Size: 777 Bytes

Versions: 3

Compression:

Stored size: 777 Bytes

Contents

require File.expand_path '../../spec_helper.rb', __FILE__
require File.expand_path '../../../lib/helpers/puppetdb', __FILE__

describe EndPoint, '#to_xml' do

  it 'should return valid xml containing the node name' do
    helper = Helpers::PuppetDB.new('fubar', '80')
    allow(helper).to receive(:get_nodes).and_return([{'name' => 'test.internal'}])
    allow(helper).to receive(:get_facts).and_return([{'certname' => 'test.internal', 'name' => 'osfamily', 'value' => 'Debian'}])

    if File.exist?('/tmp/puppetdb-resource.xml')
      FileUtils.rm '/tmp/puppetdb-resource.xml'
    end

    endpoint = EndPoint.new(helper)

    expectation = "<project>\n <node name=\"test.internal\" osfamily=\"Debian\" />\n </project>"

    endpoint.to_xml().should == expectation
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
puppetdb_rundeck-1.0.0 spec/model/xml_spec.rb
puppetdb_rundeck-0.3.1 spec/model/xml_spec.rb
puppetdb_rundeck-0.3.0 spec/model/xml_spec.rb