Sha256: 2fc5ba61146fda68d4a2c0de354a570b217025c145cdda926cc3ab7583ab27ba

Contents?: true

Size: 859 Bytes

Versions: 7

Compression:

Stored size: 859 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    module Lint
      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
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
rubocop-0.12.0 spec/rubocop/cop/lint/loop_spec.rb
rubocop-0.11.1 spec/rubocop/cop/lint/loop_spec.rb
rubocop-0.11.0 spec/rubocop/cops/lint/loop_spec.rb
rubocop-0.10.0 spec/rubocop/cops/lint/loop_spec.rb
rubocop-0.9.1 spec/rubocop/cops/lint/loop_spec.rb
sabat-rubocop-0.9.0 spec/rubocop/cops/lint/loop_spec.rb
rubocop-0.9.0 spec/rubocop/cops/lint/loop_spec.rb