Sha256: 12e9fe30c54f54243c4529e54fb66f31996cf3e17a63f8f9624ac1c742599f3c
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop module Style describe RedundantBegin do subject(:cop) { RedundantBegin.new } it 'reports an offence for def with redundant begin block' do src = ['def func', ' begin', ' ala', ' rescue => e', ' bala', ' end', 'end'] inspect_source(cop, src) expect(cop.offences.size).to eq(1) end it 'reports an offence for defs with redundant begin block' do src = ['def Test.func', ' begin', ' ala', ' rescue => e', ' bala', ' end', 'end'] inspect_source(cop, src) expect(cop.offences.size).to eq(1) end it 'accepts a def with required begin block' do src = ['def func', ' begin', ' ala', ' rescue => e', ' bala', ' end', ' something', 'end'] inspect_source(cop, src) expect(cop.offences).to be_empty end it 'accepts a defs with required begin block' do src = ['def Test.func', ' begin', ' ala', ' rescue => e', ' bala', ' end', ' something', 'end'] inspect_source(cop, src) 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/redundant_begin_spec.rb |
rubocop-0.13.0 | spec/rubocop/cop/style/redundant_begin_spec.rb |