Sha256: 287aa734ee1fb13742837649cd7f62567768dd21049cd8287461d2425fb00fd7

Contents?: true

Size: 1.38 KB

Versions: 5

Compression:

Stored size: 1.38 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.open('/tmp/debugger_puppet_manifest.pp', 'w') do |f|
      f.write(manifest_code)
    end
    '/tmp/debugger_puppet_manifest.pp'
  end

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

    OUT
  end

  after(:each) do
    # manifest_file.close
  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

5 entries across 5 versions & 1 rubygems

Version Path
puppet-debugger-1.4.0 spec/support_spec.rb
puppet-debugger-1.3.0 spec/support_spec.rb
puppet-debugger-1.2.0 spec/support_spec.rb
puppet-debugger-1.1.0 spec/support_spec.rb
puppet-debugger-1.0.0 spec/support_spec.rb