Sha256: e01b8c6cfeb00c7ec0ca6f3e76eaf7155a8995624686f523f3b3d25b789f7f1e

Contents?: true

Size: 863 Bytes

Versions: 2

Compression:

Stored size: 863 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    module Lint
      describe Loop do
        subject(: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

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.13.1 spec/rubocop/cop/lint/loop_spec.rb
rubocop-0.13.0 spec/rubocop/cop/lint/loop_spec.rb