Sha256: b70b45707a45ea3096a61e6080ef04580740eec57d2cc781fabfd1730d0c1a95

Contents?: true

Size: 800 Bytes

Versions: 3

Compression:

Stored size: 800 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Rubocop::Cop::Style::EmptyLines do
  subject(:cop) { described_class.new }

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

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

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

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



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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-0.15.0 spec/rubocop/cop/style/empty_lines_spec.rb
rubocop-0.14.1 spec/rubocop/cop/style/empty_lines_spec.rb
rubocop-0.14.0 spec/rubocop/cop/style/empty_lines_spec.rb