Sha256: b755647e12aa3ab5e846be5ac6814c60a0b12a76b3c502bb1bbe45d60d48ddab

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'
require 'tempfile'

describe 'support' do

  let(:repl) do
    PuppetRepl::Cli.new
  end

  let(:scope) do
    repl.scope
  end

  let(:puppet_version) do
    repl.mod_finder.match(repl.puppet_lib_dir)[1]
  end

  let(:manifest_file) do
    file = File.open('/tmp/repl_puppet_manifest.pp', 'w') do |f|
      f.write(manifest_code)
    end
    '/tmp/repl_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 = repl.function_map["#{puppet_version}::hiera"]
      expect(repl.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(repl.lib_dirs.count).to be >= 1
  end

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

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-repl-0.0.8 spec/support_spec.rb