Sha256: e9821feafd62ae1ea165c0bee186509f7e98f2b77780a6cca527f2332f7380cf
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop describe OpMethod do let(:om) { OpMethod.new } it 'registers an offence for arg not named other' do inspect_source(om, 'file.rb', ['def +(another)', ' another', 'end']) expect(om.offences.size).to eq(1) expect(om.offences.map(&:message)) .to eq([sprintf(OpMethod::ERROR_MESSAGE, '+')]) end it 'does not register an offence for arg named other' do inspect_source(om, 'file.rb', ['def +(other)', ' other', 'end']) expect(om.offences).to be_empty end it 'does not register an offence for []' do inspect_source(om, 'file.rb', ['def [](index)', ' other', 'end']) expect(om.offences).to be_empty end it 'does not register an offence for []=' do inspect_source(om, 'file.rb', ['def []=(index, value)', ' other', 'end']) expect(om.offences).to be_empty end it 'does not register an offence for <<' do inspect_source(om, 'file.rb', ['def <<(cop)', ' other', 'end']) expect(om.offences).to be_empty end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.6.0 | spec/rubocop/cops/op_method_spec.rb |