Sha256: 92ed22cab000f85ad96bbcfedc12c402667dc4db4e0391c35d2175158d6a20a1

Contents?: true

Size: 896 Bytes

Versions: 1

Compression:

Stored size: 896 Bytes

Contents

require 'spec_helper'

class PuppetDBRequest
  def initialize(data)
    @data = data
  end

  def data
    @data
  end
end

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

1 entries across 1 versions & 1 rubygems

Version Path
puppet-ghostbuster-0.5.0 spec/puppet-lint/plugins/ghostbuster_classes_spec.rb