Sha256: 5ff4b17199d2b34dcd169c331dcd7e61489df08f3128db93a7b8793f494df52f

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

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

  context 'with fix disabled' do
    context 'when file usage is found in puppetdb' do
      let(:path) { './modules/foo/files/bar' }

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

    context 'when parent directory with recurse => true usage is found in puppetdb' do
      let(:path) { './modules/foo/files/baz/baz' }

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

    context 'when using full module name syntax' do
      let(:path) { './modules/foo/files/used_with_file' }

      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/files/used_with_file_and_module_name' }

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

    context 'when file in ROOT is not used' do
      let(:path) { './modules/bar/files/foo' }

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

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

    context 'when file in subdir is not used' do
      let(:path) { './modules/bar/files/foo/bar' }

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

      it 'creates a warning' do
        expect(problems).to contain_warning('File bar/foo/bar 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_files_spec.rb
puppet-ghostbuster-1.2.0 spec/puppet-lint/plugins/ghostbuster_files_spec.rb
puppet-ghostbuster-1.1.0 spec/puppet-lint/plugins/ghostbuster_files_spec.rb