Sha256: ca928a883c4c709421dc387da97639a428d320c039b0be07cf50d433efee976a

Contents?: true

Size: 972 Bytes

Versions: 4

Compression:

Stored size: 972 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.8.3 spec/rubocop/cops/empty_lines_spec.rb
rubocop-0.8.2 spec/rubocop/cops/empty_lines_spec.rb
rubocop-0.8.1 spec/rubocop/cops/empty_lines_spec.rb
rubocop-0.8.0 spec/rubocop/cops/empty_lines_spec.rb