Sha256: 8fb58c9404ad8701672d2e1f15a817741f14103693243ae7e1f71610e17df91b
Contents?: true
Size: 1.77 KB
Versions: 2
Compression:
Stored size: 1.77 KB
Contents
# frozen_string_literal: true 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 'detects one problem' do expect(problems.size).to eq(2) end it 'creates a warning' do expect(problems).to contain_warning('Fact multi1 seems unused') end it 'creates 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 'does not detect any problem' do expect(problems.size).to eq(0) end end context 'when fact is used in manifest' do let(:path) { './spec/fixtures/modules/foo/lib/facter/bar.rb' } it 'does not detect any problem' do expect(problems.size).to eq(0) end end context 'when fact is used in a template' do let(:path) { './spec/fixtures/modules/foo/lib/facter/baz.rb' } it 'does not detect any problem' do expect(problems.size).to eq(0) end end context 'when fact is used in an inline_template' do let(:path) { './spec/fixtures/modules/foo/lib/facter/quux.rb' } it 'does not detect any problem' do expect(problems.size).to eq(0) end end context 'when added fact is a symbol and unused' do let(:path) { './spec/fixtures/modules/foo/lib/facter/asym.rb' } it 'detects one problem' do expect(problems.size).to eq(1) end it 'creates a warning' do expect(problems).to contain_warning('Fact asym seems unused') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
puppet-ghostbuster-1.2.1 | spec/puppet-lint/plugins/ghostbuster_facts_spec.rb |
puppet-ghostbuster-1.2.0 | spec/puppet-lint/plugins/ghostbuster_facts_spec.rb |