Sha256: a4e3d5c3d792aec5540efb150e3c40ed253b7b1d86b1ed2d97b30e6141e54b2e

Contents?: true

Size: 1.47 KB

Versions: 4

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'

describe 'ghostbuster_facts' do
  let(:code) { "Facter.add('foo')" }

  context 'with fix disabled' do

    context 'when fact is not used' do
      let(:path) { "./spec/fixtures/modules/foo/lib/facter/multi.rb" }

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

      it 'should create a warning' do
        expect(problems).to contain_warning("Fact multi1 seems unused")
      end

      it 'should create a warning' do
        expect(problems).to contain_warning("Fact multi2 seems unused")
      end
    end

    context 'when fact is used in a string' do
      let(:path) { "./spec/fixtures/modules/foo/lib/facter/foo.rb" }

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

    context 'when fact is used in manifest' do
      let(:path) { "./spec/fixtures/modules/foo/lib/facter/bar.rb" }

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

    context 'when fact is used in a template' do
      let(:path) { "./spec/fixtures/modules/foo/lib/facter/baz.rb" }

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

    context 'when fact is used in an inline_template' do
      let(:path) { "./spec/fixtures/modules/foo/lib/facter/quux.rb" }

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppet-ghostbuster-0.9.0 spec/puppet-lint/plugins/ghostbuster_facts_spec.rb
puppet-ghostbuster-0.8.0 spec/puppet-lint/plugins/ghostbuster_facts_spec.rb
puppet-ghostbuster-0.7.3 spec/puppet-lint/plugins/ghostbuster_facts_spec.rb
puppet-ghostbuster-0.7.2 spec/puppet-lint/plugins/ghostbuster_facts_spec.rb