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