Sha256: 31db668e5576cf17dfc31aab42f117e1495165378b71ddd3fed30e551ae82522

Contents?: true

Size: 432 Bytes

Versions: 3

Compression:

Stored size: 432 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    describe OneLineConditional do
      let (:olc) { OneLineConditional.new }

      it 'registers an offence for one line if/then/end' do
        inspect_source(olc, '', ['if cond then run else dont end'])
        olc.offences.map(&:message).should ==
          ['Favor the ternary operator (?:) over if/then/else/end constructs.']
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-0.3.2 spec/rubocop/cops/one_line_conditional_spec.rb
rubocop-0.3.1 spec/rubocop/cops/one_line_conditional_spec.rb
rubocop-0.3.0 spec/rubocop/cops/one_line_conditional_spec.rb