Sha256: 78b18ae423be002d0ac596dc508bdf506959444613eb72d5b93efa28e1633760
Contents?: true
Size: 1.74 KB
Versions: 2
Compression:
Stored size: 1.74 KB
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop module Style describe ColonMethodCall do let(:cop) { ColonMethodCall.new } it 'registers an offence for instance method call' do inspect_source(cop, ['test::method_name']) expect(cop.offences.size).to eq(1) end it 'registers an offence for instance method call with arg' do inspect_source(cop, ['test::method_name(arg)']) expect(cop.offences.size).to eq(1) end it 'registers an offence for class method call' do inspect_source(cop, ['Class::method_name']) expect(cop.offences.size).to eq(1) end it 'registers an offence for class method call with arg' do inspect_source(cop, ['Class::method_name(arg, arg2)']) expect(cop.offences.size).to eq(1) end it 'does not register an offence for constant access' do inspect_source(cop, ['Tip::Top::SOME_CONST']) expect(cop.offences).to be_empty end it 'does not register an offence for nested class' do inspect_source(cop, ['Tip::Top.some_method']) expect(cop.offences).to be_empty end it 'does not register an offence for op methods' do inspect_source(cop, ['Tip::Top.some_method[3]']) expect(cop.offences).to be_empty end it 'auto-corrects "::" with "."' do new_source = autocorrect_source(cop, 'test::method') expect(new_source).to eq('test.method') end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.11.0 | spec/rubocop/cops/style/colon_method_call_spec.rb |
rubocop-0.10.0 | spec/rubocop/cops/style/colon_method_call_spec.rb |