Sha256: 85ff75f1b0539726ec58c38520be708b9fe18ae17b695f32f95426bfccbd338d

Contents?: true

Size: 737 Bytes

Versions: 2

Compression:

Stored size: 737 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  it 'registers an offence for spaces inside parens' do
    inspect_source(cop, ['f( 3)',
                         'g(3 )'])
    expect(cop.messages).to eq(
      ['Space inside parentheses detected.',
       'Space inside parentheses detected.'])
  end

  it 'accepts parentheses in block parameter list' do
    inspect_source(cop,
                   ['list.inject(Tms.new) { |sum, (label, item)|',
                    '}'])
    expect(cop.messages).to be_empty
  end

  it 'accepts parentheses with no spaces' do
    inspect_source(cop, ['split("\n")'])
    expect(cop.messages).to be_empty
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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