Sha256: b3c513be14de2e93fe5c0f74a9a900211a946132a143c061deaa68bc4acf5ab2

Contents?: true

Size: 610 Bytes

Versions: 2

Compression:

Stored size: 610 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Rubocop::Cop::Style::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

Version data entries

2 entries across 2 versions & 1 rubygems

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