Sha256: dfcc757c8762dbb9a8c88dfbae7413d1f8d1a95a8919958e0a1c182fbffc3998

Contents?: true

Size: 1.42 KB

Versions: 5

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'puppet-debugger'
require 'puppet-debugger/plugin_test_helper'
require 'pluginator'

describe :vars do
  include_examples 'plugin_tests'
  let(:args) { [] }

  it 'display facts variable' do
    debugger_output = /facts/
    output = plugin.run(args)
    expect(output).to match(debugger_output)
  end
  it 'display server facts variable' do
    debugger_output = /server_facts/
    expect(plugin.run(args)).to match(debugger_output) if Puppet.version.to_f >= 4.1
  end
  it 'display serverversion variable' do
    debugger_output = /serverversion/
    expect(plugin.run(args)).to match(debugger_output) if Puppet.version.to_f >= 4.1
  end
  it 'display local variable' do
    debugger.handle_input("$var1 = 'value1'")
    expect(plugin.run(args)).to match(/value1/)
  end

  describe 'resource' do
    let(:input) do
      "$service_require = Package['httpd']"
    end
    it 'can process a resource' do
      debugger_output = /Facts/
      debugger.handle_input(input)
      expect(plugin.run(args)).to match(debugger_output)
    end
  end

  describe 'list variables' do
    let(:input) do
      <<-OUT
      class test( $param1 = "files", $param2 = $param1 ) {}
      include test
      OUT
    end
    it 'ls test' do
      debugger.handle_input(input)
      out = plugin.run(['test'])
      expect(out).to include('"param1"')
      expect(out).to include('"param2"')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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