Sha256: f5aaddd15f05859d4497ccd401d0c6393d53bec890e625bfe18af80d669681db

Contents?: true

Size: 795 Bytes

Versions: 2

Compression:

Stored size: 795 Bytes

Contents

require 'spec_helper'

describe 'ghostbuster_classes' do
  #let(:path) { "./manifests/site.pp" }
  let(:path) { "./modules/foo/manifests/init.pp" }

  context 'with fix disabled' do

    before :each do
      expect(PuppetGhostbuster::PuppetDB).to \
        receive(:classes).and_return(['Foo'])
    end

    context 'when class is used' do
      let(:code) { "class foo {}" }

      it 'should not detect any problem' do
        expect(problems).to have(0).problems
      end
    end

    context 'when class is not used' do
      let(:code) { "class bar {}" }

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

      it 'should create a warning' do
        expect(problems).to contain_warning('Class 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_classes_spec.rb
puppet-ghostbuster-0.5.1 spec/puppet-lint/plugins/ghostbuster_classes_spec.rb