Sha256: c6fc9b86d0b3645095a5b6717fc4e2f9e239373f6d5e7228f29dfa86ea13b91e

Contents?: true

Size: 886 Bytes

Versions: 2

Compression:

Stored size: 886 Bytes

Contents

require 'spec_helper'

describe 'ghostbuster_defines' do
  include PuppetGhostbusterSpec

  context 'with fix disabled' do

    context 'when define is used' do
      let(:code) { "define foo {}" }
      let(:path) { "./modules/foo/manifests/init.pp" }

      it 'should not detect any problem' do
        expect_puppetdb_resources([:'=', 'type', 'Foo'], [{}])
        expect(problems).to have(0).problems
      end
    end

    context 'when define is not used' do
      let(:code) { "define bar {}" }
      let(:path) { "./modules/bar/manifests/init.pp" }

      before :each do
        expect_puppetdb_resources([:'=', 'type', 'Bar'], [])
      end

      it 'should detect one problem' do
        expect(problems).to have(1).problems
      end

      it 'should create a warning' do
        expect(problems).to contain_warning('Define Bar seems unused')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-ghostbuster-0.6.0 spec/puppet-lint/plugins/ghostbuster_defines_spec.rb
puppet-ghostbuster-0.5.1 spec/puppet-lint/plugins/ghostbuster_defines_spec.rb