Sha256: 1a21475af39342e3026658cb3efda695ab733edeff22c18e67ea89b815a765cd

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    module Style
      describe EmptyLines do
        subject(: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

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.13.1 spec/rubocop/cop/style/empty_lines_spec.rb
rubocop-0.13.0 spec/rubocop/cop/style/empty_lines_spec.rb