Sha256: cac2680bb9b3ab4a086954daa4c366808799b204837912cd170a780dc909c98a

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    module Style
      describe EmptyLines do
        let(:empty_lines) { EmptyLines.new }

        it 'registers an offence for consecutive empty lines' do
          inspect_source(empty_lines,
                         ['test = 5', '', '', '', 'top'])
          expect(empty_lines.offences.size).to eq(2)
        end

        it 'works when there are no tokens' do
          inspect_source(empty_lines,
                         ['#comment'])
          expect(empty_lines.offences).to be_empty
        end

        it 'handles comments' do
          inspect_source(empty_lines,
                         ['test', '', '#comment', 'top'])
          expect(empty_lines.offences).to be_empty
        end

        it 'does not register an offence for empty lines in a string' do
          inspect_source(empty_lines, ['result = "test



                                        string"'])
          expect(empty_lines.offences).to be_empty
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
rubocop-0.12.0 spec/rubocop/cop/style/empty_lines_spec.rb
rubocop-0.11.1 spec/rubocop/cop/style/empty_lines_spec.rb
rubocop-0.11.0 spec/rubocop/cops/style/empty_lines_spec.rb
rubocop-0.10.0 spec/rubocop/cops/style/empty_lines_spec.rb
rubocop-0.9.1 spec/rubocop/cops/style/empty_lines_spec.rb
sabat-rubocop-0.9.0 spec/rubocop/cops/style/empty_lines_spec.rb
rubocop-0.9.0 spec/rubocop/cops/style/empty_lines_spec.rb