Sha256: 5d27b0275e8f81dcd84b6dfbd3e8f073d94647a7b4e49b797009a3509590e316
Contents?: true
Size: 887 Bytes
Versions: 4
Compression:
Stored size: 887 Bytes
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop describe AvoidFor do let(:af) { AvoidFor.new } it 'registers an offence for for' do inspect_source(af, ['def func', ' for n in [1, 2, 3] do', ' puts n', ' end', 'end']) expect(af.offences.size).to eq(1) expect(af.offences.map(&:message)) .to eq([AvoidFor::MSG]) end it 'does not register an offence for :for' do inspect_source(af, ['[:for, :ala, :bala]']) expect(af.offences).to be_empty end it 'does not register an offence for def for' do inspect_source(af, ['def for; end']) expect(af.offences).to be_empty end end end end
Version data entries
4 entries across 4 versions & 1 rubygems