Sha256: 6175048701fee79017275b579e0fdec4e951e0752e9780436c327f28f2285d20

Contents?: true

Size: 762 Bytes

Versions: 1

Compression:

Stored size: 762 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  it 'registers an offence for string concat at line end' do
    inspect_source(cop,
                   ['top = "test" +',
                    '"top"'])
    expect(cop.offences.size).to eq(1)
  end

  it 'accepts string concat on the same line' do
    inspect_source(cop,
                   ['top = "test" + "top"'])
    expect(cop.offences).to be_empty
  end

  it 'autocorrects by replacing + with \\' do
    corrected = autocorrect_source(cop,
                                   ['top = "test" +',
                                    '"top"'])
    expect(corrected).to eq ['top = "test" \\', '"top"'].join("\n")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-0.18.0 spec/rubocop/cop/style/line_end_concatenation_spec.rb