Sha256: de1c779f4b699fb451ffed0d4e291420e6044c56f58186839d5a0e451cdfa402

Contents?: true

Size: 1.25 KB

Versions: 26

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe 'manifest_whitespace_missing_newline_end_of_file' do
  let(:single_newline_end_of_file_msg) { 'there should be a single newline at the end of a manifest' }

  context 'with fix disabled' do
    context 'with no new line at the end of a manifest' do
      let(:code) do
        'class example { }'
      end

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

      it 'should create a error' do
        expect(problems).to contain_error(single_newline_end_of_file_msg).on_line(1).in_column(17)
      end
    end
  end

  context 'with fix enabled' do
    before do
      PuppetLint.configuration.fix = true
    end

    after do
      PuppetLint.configuration.fix = false
    end

    context 'with no new line at the end of a manifest' do
      let(:code) do
        'class example { }'
      end

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

      it 'should fix the manifest' do
        expect(problems).to contain_fixed(single_newline_end_of_file_msg).on_line(1).in_column(17)
      end

      it 'should add the final newline' do
        expect(manifest).to eq("class example { }\n")
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
puppet-lint-manifest_whitespace-check-0.2.8 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.2.7 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.2.6 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.2.5 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.2.4 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.2.3 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.2.2 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.2.1 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.2.0 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.1.17 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.1.16 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.1.15 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.1.14 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.1.13 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.1.12 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.1.11 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.1.10 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.1.9 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.1.8 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb
puppet-lint-manifest_whitespace-check-0.1.7 spec/puppet-lint/plugins/manifest_whitespace_missing_newline_end_of_file_spec.rb