Sha256: 843213ed2e93f5adba4cf1f183ac523a5644fd2aa41e3199287741318863f1bf

Contents?: true

Size: 747 Bytes

Versions: 3

Compression:

Stored size: 747 Bytes

Contents

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

describe EndPoint, '#to_yaml' do

  it 'should return valid yaml 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.yaml')
      FileUtils.rm '/tmp/puppetdb-resource.yaml'
    end

    endpoint = EndPoint.new(helper)

    expectation = "---\ntest.internal:\n  osfamily: Debian\n"

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

Version data entries

3 entries across 3 versions & 1 rubygems

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