Sha256: 7676310b88423a85dc04f3a6ac22f5da0616fe1ccc7c00e1f282facb3421f81e
Contents?: true
Size: 1.86 KB
Versions: 1
Compression:
Stored size: 1.86 KB
Contents
require 'spec_helper' describe 'variable_contains_upcase' do let(:msg) { 'variable contains a capital letter' } context 'a variable containing a capital' do let(:code) { '$fOobar' } it 'onlies detect a single problem' do expect(problems).to have(1).problem end it 'creates a warning' do expect(problems).to contain_warning(msg).on_line(1).in_column(1) end end context 'variable containing a capital' do let(:code) { '" $fOobar"' } it 'onlies detect a single problem' do expect(problems).to have(1).problem end it 'creates a warning' do expect(problems).to contain_warning(msg).on_line(1).in_column(3) end end context 'with fix enabled' do before do PuppetLint.configuration.fix = true end after do PuppetLint.configuration.fix = false end context 'fix variable containing a capital' do let(:code) { '" $fOobar"' } it 'onlies detect a single problem' do expect(problems).to have(1).problem end it 'fixes the manifest' do expect(problems).to contain_fixed(msg).on_line(1).in_column(3) end it 'downcases the variable name' do expect(manifest).to eq('" $foobar"') end end context 'a hash with an upcase key should not fail' do let(:code) { ' $myhash["Foo"]' } it 'does not detect a single problem' do expect(problems).to have(0).problem end end context 'a hash with an upcase key should not fail' do let(:code) { ' $myhash["Foo"]["bAr"]' } it 'does not detect a single problem' do expect(problems).to have(0).problem end end context 'a hash variable with an upcase key should fail' do let(:code) { ' $myHash["foo"]["bar"]' } it 'detects a single problem' do expect(problems).to have(1).problem end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
puppet-lint-variable_contains_upcase-2.0.0 | spec/puppet-lint/plugins/variable_contains_upcase_spec.rb |