Sha256: bafd8f501ce5f6c084930c85569c8d1cb8d3bde75a1a22df90d6f7f635b96079
Contents?: true
Size: 1.83 KB
Versions: 2
Compression:
Stored size: 1.83 KB
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop module Lint describe UselessAssignment do let(:cop) { UselessAssignment.new } it 'registers an offence for def ending with lvar assignment' do inspect_source(cop, ['def test', ' something', ' top = 5', 'end' ]) expect(cop.offences.size).to eq(1) end it 'registers an offence for defs ending with lvar assignment' do inspect_source(cop, ['def Top.test', ' something', ' top = 5', 'end' ]) expect(cop.offences.size).to eq(1) end it 'registers an offence for def ending with lvar attr assignment' do inspect_source(cop, ['def test', ' top = Top.new', ' top.attr = 5', 'end' ]) expect(cop.offences.size).to eq(1) end it 'registers an offence for defs ending with lvar attr assignment' do inspect_source(cop, ['def Top.test', ' top = Top.new', ' top.attr = 5', 'end' ]) expect(cop.offences.size).to eq(1) end it 'is not confused by operators ending with =' do inspect_source(cop, ['def test', ' top == 5', 'end' ]) expect(cop.offences).to be_empty end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.11.1 | spec/rubocop/cop/lint/useless_assignment_spec.rb |
rubocop-0.11.0 | spec/rubocop/cops/lint/useless_assignment_spec.rb |