Sha256: 10bf87acb2b7590c2b2eec4d054e1651c58c960bda61aff540c4cb7dccc50156

Contents?: true

Size: 748 Bytes

Versions: 2

Compression:

Stored size: 748 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

        it 'registers an offence for parens in method call without args' do
          inspect_source(cop, ['top.test()'])
        end

        it 'it accepts no parens in method call without args' do
          inspect_source(cop, ['top.test'])
        end

        it 'it accepts parens in method call with args' do
          inspect_source(cop, ['top.test(a)'])
        end

        it 'auto-corrects by removing unneeded braces' do
          new_source = autocorrect_source(cop, 'test()')
          expect(new_source).to eq('test')
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.13.1 spec/rubocop/cop/style/method_call_parentheses_spec.rb
rubocop-0.13.0 spec/rubocop/cop/style/method_call_parentheses_spec.rb