Sha256: b76f8d09dbe3ba190600cd757ca176c97fde614df22294f50b17d79b8f24246f
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop module Style describe WhenThen do let(:wt) { WhenThen.new } it 'registers an offence for when x;' do inspect_source(wt, ['case a', 'when b; c', 'end']) expect(wt.offences.map(&:message)).to eq( ['Never use "when x;". Use "when x then" instead.']) end it 'accepts when x then' do inspect_source(wt, ['case a', 'when b then c', 'end']) expect(wt.offences.map(&:message)).to be_empty end it 'accepts ; separating statements in the body of when' do inspect_source(wt, ['case a', 'when b then c; d', 'end', '', 'case e', 'when f', ' g; h', 'end']) expect(wt.offences.map(&:message)).to be_empty end end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
rubocop-0.9.1 | spec/rubocop/cops/style/when_then_spec.rb |
sabat-rubocop-0.9.0 | spec/rubocop/cops/style/when_then_spec.rb |
rubocop-0.9.0 | spec/rubocop/cops/style/when_then_spec.rb |