Sha256: c9e4711653e0ed717ceefbc3671c25443b2a711665aa4dce43c435bdbb68d4af
Contents?: true
Size: 851 Bytes
Versions: 7
Compression:
Stored size: 851 Bytes
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop module Style describe UnlessElse do let(:ue) { UnlessElse.new } it 'registers an offence for an unless with else' do inspect_source(ue, ['unless x', ' a = 1', 'else', ' a = 0', 'end']) expect(ue.offences.map(&:message)).to eq( ['Never use unless with else. Rewrite these with the ' + 'positive case first.']) end it 'accepts an unless without else' do inspect_source(ue, ['unless x', ' a = 1', 'end']) expect(ue.offences.map(&:message)).to be_empty end end end end end
Version data entries
7 entries across 7 versions & 2 rubygems