Sha256: f96589ae2fe2f1912bf4b1e4073f78b412b6ce1977e9be4401dd6a2410e4087f

Contents?: true

Size: 400 Bytes

Versions: 6

Compression:

Stored size: 400 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Rubocop::Cop::Style::OneLineConditional do
  subject(:cop) { described_class.new }

  it 'registers an offense for one line if/then/end' do
    inspect_source(cop, ['if cond then run else dont end'])
    expect(cop.messages).to eq(['Favor the ternary operator (?:)' \
                                ' over if/then/else/end constructs.'])
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubocop-0.22.0 spec/rubocop/cop/style/one_line_conditional_spec.rb
rubocop-0.21.0 spec/rubocop/cop/style/one_line_conditional_spec.rb
rubocop-0.20.1 spec/rubocop/cop/style/one_line_conditional_spec.rb
rubocop-0.20.0 spec/rubocop/cop/style/one_line_conditional_spec.rb
rubocop-0.19.1 spec/rubocop/cop/style/one_line_conditional_spec.rb
rubocop-0.19.0 spec/rubocop/cop/style/one_line_conditional_spec.rb