Sha256: 043fa7cae250ef1477495557a7f4327823f76f59a93dc2de338a6af74701b6f6

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

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

  context 'with fix disabled' do

    context 'when function is not used' do
      let(:path) { "./spec/fixtures/modules/foo/lib/puppet/parser/functions/foo.rb" }

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

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

    context 'when function is used in a manifest' do
      let(:path) { "./spec/fixtures/modules/foo/lib/puppet/parser/functions/bar.rb" }

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

    context 'when function is used in a template using scope.function_baz()' do
      let(:path) { "./spec/fixtures/modules/foo/lib/puppet/parser/functions/baz.rb" }

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

    context 'when function is used in a template using Puppet::Parser::Functions.function(:quux)' do
      let(:path) { "./spec/fixtures/modules/foo/lib/puppet/parser/functions/quux.rb" }

      it 'should not detect any problem' do
        expect(problems).to have(0).problems
      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_functions_spec.rb
puppet-ghostbuster-0.8.0 spec/puppet-lint/plugins/ghostbuster_functions_spec.rb
puppet-ghostbuster-0.7.3 spec/puppet-lint/plugins/ghostbuster_functions_spec.rb
puppet-ghostbuster-0.7.2 spec/puppet-lint/plugins/ghostbuster_functions_spec.rb
puppet-ghostbuster-0.7.1 spec/puppet-lint/plugins/ghostbuster_functions_spec.rb
puppet-ghostbuster-0.7.0 spec/puppet-lint/plugins/ghostbuster_functions_spec.rb