Sha256: 5ad0df89418e9e4c8f6a36b69d5caf57fda8950e735dd0b04a888dd8f103dc33
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop describe WhenThen do let (:wt) { WhenThen.new } it 'registers an offence for when x;' do inspect_source(wt, 'file.rb', ['case a', 'when b; c', 'end']) wt.offences.map(&:message).should == ['Never use "when x;". Use "when x then" instead.'] end it 'accepts when x then' do inspect_source(wt, 'file.rb', ['case a', 'when b then c', 'end']) wt.offences.map(&:message).should == [] end it 'accepts ; separating statements in the body of when' do inspect_source(wt, 'file.rb', ['case a', 'when b then c; d', 'end', '', 'case e', 'when f', ' g; h', 'end']) wt.offences.map(&:message).should == [] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.3.2 | spec/rubocop/cops/when_then_spec.rb |
rubocop-0.3.1 | spec/rubocop/cops/when_then_spec.rb |
rubocop-0.3.0 | spec/rubocop/cops/when_then_spec.rb |