Sha256: dca41245f86a993682046ca05d3c3902052d6d701e540a3926c682462e19fa5d

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe 'unquoted_string_in_selector' do
  let(:msg) { 'expected quoted string in selector' }

  context 'with fix disabled' do
    context 'quoted case' do
      let(:code) do
        <<-EOS
        $rootgroup = $osfamily ? {
          'Solaris'          => 'wheel',
          /(Darwin|FreeBSD)/ => 'wheel',
          default            => 'root',
        }
        EOS
      end

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

    context ':NAME in case' do
      let(:code) do
        <<-EOS
        $rootgroup = $osfamily ? {
          solaris            => 'wheel',
          /(Darwin|FreeBSD)/ => 'wheel',
          default            => 'root',
        }
        EOS
      end

      it 'should create a warning' do
        expect(problems).to contain_warning(msg).on_line(1).in_column(32)
      end
    end

    context ':CLASSREF in case' do
      let(:code) do
        <<-EOS
        $rootgroup = $osfamily ? {
          Solaris            => 'wheel',
          /(Darwin|FreeBSD)/ => 'wheel',
          default            => 'root',
        }
        EOS
      end

      it 'should create a warning' do
        expect(problems).to contain_warning(msg).on_line(1).in_column(32)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-lint-unquoted_string-check-0.1.0 spec/puppet-lint/plugins/check_unquoted_string_in_case/check_unquoted_string_in_selector_spec.rb