Sha256: a758292365d1f65d7a4faf91e300c184ef9681fb61726e7737015a99a5d5a0ca
Contents?: true
Size: 1.28 KB
Versions: 2
Compression:
Stored size: 1.28 KB
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop module Style describe EvenOdd do subject(:cop) { described_class.new } it 'registers an offence for x % 2 == 0' do inspect_source(cop, ['x % 2 == 0']) expect(cop.offences.size).to eq(1) expect(cop.messages).to eq([EvenOdd::MSG_EVEN]) end it 'registers an offence for (x % 2) == 0' do inspect_source(cop, ['(x % 2) == 0']) expect(cop.offences.size).to eq(1) expect(cop.messages).to eq([EvenOdd::MSG_EVEN]) end it 'registers an offence for x % 2 == 1' do inspect_source(cop, ['x % 2 == 1']) expect(cop.offences.size).to eq(1) expect(cop.messages).to eq([EvenOdd::MSG_ODD]) end it 'registers an offence for (x % 2) == 1' do inspect_source(cop, ['(x % 2) == 1']) expect(cop.offences.size).to eq(1) expect(cop.messages).to eq([EvenOdd::MSG_ODD]) end it 'accepts x % 3 == 0' do inspect_source(cop, ['x % 3 == 0']) 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.13.1 | spec/rubocop/cop/style/even_odd_spec.rb |
rubocop-0.13.0 | spec/rubocop/cop/style/even_odd_spec.rb |