Sha256: 7c79660dba50246abe79157bc89d8cd69b6fa8c6c97096fcca4d647e5664ec18

Contents?: true

Size: 958 Bytes

Versions: 7

Compression:

Stored size: 958 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    module Style
      describe SpaceInsideParens do
        let(:space) { SpaceInsideParens.new }

        it 'registers an offence for spaces inside parens' do
          inspect_source(space, ['f( 3)',
                                 'g(3 )'])
          expect(space.offences.map(&:message)).to eq(
            ['Space inside parentheses detected.',
             'Space inside parentheses detected.'])
        end

        it 'accepts parentheses in block parameter list' do
          inspect_source(space,
                         ['list.inject(Tms.new) { |sum, (label, item)|',
                          '}'])
          expect(space.offences.map(&:message)).to be_empty
        end

        it 'accepts parentheses with no spaces' do
          inspect_source(space, ['split("\n")'])
          expect(space.offences.map(&:message)).to be_empty
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
rubocop-0.12.0 spec/rubocop/cop/style/space_inside_parens_spec.rb
rubocop-0.11.1 spec/rubocop/cop/style/space_inside_parens_spec.rb
rubocop-0.11.0 spec/rubocop/cops/style/space_inside_parens_spec.rb
rubocop-0.10.0 spec/rubocop/cops/style/space_inside_parens_spec.rb
rubocop-0.9.1 spec/rubocop/cops/style/space_inside_parens_spec.rb
sabat-rubocop-0.9.0 spec/rubocop/cops/style/space_inside_parens_spec.rb
rubocop-0.9.0 spec/rubocop/cops/style/space_inside_parens_spec.rb