Sha256: 5241ddd4d3f3f279f73bca5cf3d7d27543e1386a7c997dcdd2dd0170013c25e4

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe 'resource_reference_without_title_capital' do

  context 'a proper reference' do
    let(:msg) { 'whitespce between reference type and title' }
    let(:code) { "file { 'foo': ensure => file, notify => Title['one'],}" }

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

  context 'a proper reference in quotes' do
    let(:code) { "file { 'foo': ensure => file, notify => Title['One'],}" }

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

  context 'a proper reference as variable' do
    let(:code) { "file { 'foo': ensure => file, notify => Title[$foo_var],}" }

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

  context 'resource reference with title as capital letter' do
    let(:msg) { 'resource reference with title with capital letter' }
    let(:code) { "file { 'foo': ensure => file, notify => Title[One],}" }

    it 'should only detect a single problem' do
      expect(problems).to have(1).problem
    end

    it 'should create an error' do
      expect(problems).to contain_error(msg).on_line(1)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-lint-resource_reference_syntax-1.0.3 spec/puppet-lint/plugins/resource_reference_without_title_capital_spec.rb