Sha256: 8ae63da3146a9c644d9bf117f4047bb196000ac8414bbe07cac5e63780487590

Contents?: true

Size: 677 Bytes

Versions: 5

Compression:

Stored size: 677 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  it 'registers an offence for inclusive flip flops' do
    inspect_source(cop,
                   ['DATA.each_line do |line|',
                    'print line if (line =~ /begin/)..(line =~ /end/)',
                    'end'])
    expect(cop.offences.size).to eq(1)
  end

  it 'registers an offence for exclusive flip flops' do
    inspect_source(cop,
                   ['DATA.each_line do |line|',
                    'print line if (line =~ /begin/)...(line =~ /end/)',
                    'end'])
    expect(cop.offences.size).to eq(1)
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
ridecharge-rubocop-0.0.1 spec/rubocop/cop/style/flip_flop_spec.rb
rubocop-0.18.1 spec/rubocop/cop/style/flip_flop_spec.rb
rubocop-0.18.0 spec/rubocop/cop/style/flip_flop_spec.rb
rubocop-0.17.0 spec/rubocop/cop/style/flip_flop_spec.rb
rubocop-0.16.0 spec/rubocop/cop/style/flip_flop_spec.rb