Sha256: 0df30507d192ca228a70e4d9e39d2b40432fff13667bc88819e66e07ee76753b
Contents?: true
Size: 1.18 KB
Versions: 4
Compression:
Stored size: 1.18 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Rubocop::Cop::Style::LambdaCall, :config do subject(:cop) { described_class.new(config) } context 'when style is set to call' do let(:cop_config) { { 'EnforcedStyle' => 'call' } } it 'registers an offence for x.()' do inspect_source(cop, ['x.(a, b)']) expect(cop.offences.size).to eq(1) end it 'accepts x.call()' do inspect_source(cop, ['x.call(a, b)']) expect(cop.offences).to be_empty end it 'auto-corrects x.() to x.call()' do new_source = autocorrect_source(cop, ['a.(x)']) expect(new_source).to eq('a.call(x)') end end context 'when style is set to braces' do let(:cop_config) { { 'EnforcedStyle' => 'braces' } } it 'registers an offence for x.call()' do inspect_source(cop, ['x.call(a, b)']) expect(cop.offences.size).to eq(1) end it 'accepts x.()' do inspect_source(cop, ['x.(a, b)']) expect(cop.offences).to be_empty end it 'auto-corrects x.call() to x.()' do new_source = autocorrect_source(cop, ['a.call(x)']) expect(new_source).to eq('a.(x)') end end end
Version data entries
4 entries across 4 versions & 1 rubygems