Sha256: 765e11dff0fd533cd7c893bf118e34f70d6acb633f3f8e76b3136e34f9a593bc

Contents?: true

Size: 1.64 KB

Versions: 6

Compression:

Stored size: 1.64 KB

Contents

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 'should not detect any problem' do
        expect(problems).to have(0).problems
      end
    end

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

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

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

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

    context 'when using $module_name syntax' do
      let(:path) { "./modules/foo/files/used_with_file_and_module_name" }

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

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

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

      it 'should create 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 'should detect one problem' do
        expect(problems).to have(1).problems
      end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
puppet-ghostbuster-0.9.0 spec/puppet-lint/plugins/ghostbuster_files_spec.rb
puppet-ghostbuster-0.8.0 spec/puppet-lint/plugins/ghostbuster_files_spec.rb
puppet-ghostbuster-0.7.3 spec/puppet-lint/plugins/ghostbuster_files_spec.rb
puppet-ghostbuster-0.7.2 spec/puppet-lint/plugins/ghostbuster_files_spec.rb
puppet-ghostbuster-0.7.1 spec/puppet-lint/plugins/ghostbuster_files_spec.rb
puppet-ghostbuster-0.7.0 spec/puppet-lint/plugins/ghostbuster_files_spec.rb