Sha256: 7c74de6d579f89ee6e6a17c0439d51aa8d8a9bb4e5eedfb47f24f3967af8dfff
Contents?: true
Size: 788 Bytes
Versions: 4
Compression:
Stored size: 788 Bytes
Contents
# encoding: utf-8 require 'spec_helper' module Rubocop module Cop 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
Version data entries
4 entries across 4 versions & 1 rubygems