Sha256: d61eeed2cd33701116d223ae61fbd4cd477187dc264345cb5ea887bfc8696fcf

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe 'ghostbuster_templates' do
  let(:code) { '' }

  context 'with fix disabled' do
    context 'when using full module name syntax' do
      let(:path) { './modules/foo/templates/used_with_template' }

      it 'does not detect any problem' do
        expect(problems.size).to eq(0)
      end
    end

    context 'when using $module_name syntax' do
      let(:path) { './modules/foo/templates/used_with_template_and_module_name' }

      it 'does not detect any problem' do
        expect(problems.size).to eq(0)
      end
    end

    context 'when using template in template' do
      let(:path) { './modules/foo/templates/used_in_template.erb' }

      it 'does not detect any problem' do
        expect(problems.size).to eq(0)
      end
    end

    context 'when template usage is not found in manifests' do
      let(:path) { './modules/foo/templates/unused' }

      it 'detects one problem' do
        expect(problems.size).to eq(1)
      end

      it 'creates a warning' do
        expect(problems).to contain_warning('Template foo/unused seems unused')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
puppet-ghostbuster-1.2.1 spec/puppet-lint/plugins/ghostbuster_templates_spec.rb
puppet-ghostbuster-1.2.0 spec/puppet-lint/plugins/ghostbuster_templates_spec.rb
puppet-ghostbuster-1.1.0 spec/puppet-lint/plugins/ghostbuster_templates_spec.rb