Sha256: 355277540d0577d7605cf443356d11f592b67e5738b7ab4a61b4bd9aa822f5fb

Contents?: true

Size: 797 Bytes

Versions: 4

Compression:

Stored size: 797 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    describe Loop do
      let(:loop) { Loop.new }

      it 'registers an offence for begin/end/while' do
        inspect_source(loop, ['begin something; top; end while test'])
        expect(loop.offences.size).to eq(1)
      end

      it 'registers an offence for begin/end/until' do
        inspect_source(loop, ['begin something; top; end until test'])
        expect(loop.offences.size).to eq(1)
      end

      it 'accepts normal while' do
        inspect_source(loop, ['while test; one; two; end'])
        expect(loop.offences).to be_empty
      end

      it 'accepts normal until' do
        inspect_source(loop, ['until test; one; two; end'])
        expect(loop.offences).to be_empty
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.8.3 spec/rubocop/cops/loop_spec.rb
rubocop-0.8.2 spec/rubocop/cops/loop_spec.rb
rubocop-0.8.1 spec/rubocop/cops/loop_spec.rb
rubocop-0.8.0 spec/rubocop/cops/loop_spec.rb