Sha256: 0a692a1facdf0df3c92a4290e7a4ab542bce0aa5d78055c9c843a214cacf68e7

Contents?: true

Size: 1.65 KB

Versions: 9

Compression:

Stored size: 1.65 KB

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'tempfile'

describe 'support' do
  let(:output) do
    StringIO.new
  end

  let(:debugger) do
    PuppetDebugger::Cli.new(out_buffer: output)
  end

  let(:scope) do
    debugger.scope
  end

  let(:puppet_version) do
    debugger.puppet_lib_dir.scan(debugger.mod_finder).flatten.last
  end

  let(:manifest_file) do
    file = File.open('/tmp/debugger_puppet_manifest.pp', 'w') do |f|
      f.write(manifest_code)
    end
    '/tmp/debugger_puppet_manifest.pp'
  end

  let(:manifest_code) do
    <<-EOF
    file{'/tmp/test.txt': ensure => absent } \n
    notify{'hello_there':} \n
    service{'httpd': ensure => running}\n

    EOF
  end

  after(:each) do
    # manifest_file.close
  end

  context '#function_map' do
    it 'should list functions' do
      func = debugger.function_map["#{puppet_version}::hiera"]
      expect(debugger.function_map).to be_instance_of(Hash)
      expect(func).to eq(name: 'hiera', parent: puppet_version)
    end
  end

  it 'should return a puppet version' do
    expect(puppet_version).to match(/puppet-\d\.\d+.\d/)
  end

  it 'should return lib dirs' do
    expect(debugger.lib_dirs.count).to be >= 1
  end

  it 'should return module dirs' do
    expect(debugger.modules_paths.count).to be >= 1
  end

  it 'should return a list of default facts' do
    expect(debugger.default_facts.values).to be_instance_of(Hash)
    expect(debugger.default_facts.values['fqdn']).to eq('foo.example.com')
  end

  it 'should return a list of facts' do
    expect(debugger.node.facts.values).to be_instance_of(Hash)
    expect(debugger.node.facts.values['fqdn']).to eq('foo.example.com')
  end


end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
puppet-debugger-0.10.3 spec/support_spec.rb
puppet-debugger-0.10.2 spec/support_spec.rb
puppet-debugger-0.10.1 spec/support_spec.rb
puppet-debugger-0.10.0 spec/support_spec.rb
puppet-debugger-0.9.1 spec/support_spec.rb
puppet-debugger-0.9.0 spec/support_spec.rb
puppet-debugger-0.8.1 spec/support_spec.rb
puppet-debugger-0.8.0 spec/support_spec.rb
puppet-debugger-0.7.0 spec/support_spec.rb