Sha256: 13fa873cead68f7cd6b8150a153137049a3573e6bc89173591494fda28d840ff

Contents?: true

Size: 842 Bytes

Versions: 2

Compression:

Stored size: 842 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

        it 'registers an offence for for' do
          inspect_source(cop,
                         ['def func',
                          '  for n in [1, 2, 3] do',
                          '    puts n',
                          '  end',
                          'end'])
          expect(cop.offences.size).to eq(1)
        end

        it 'does not register an offence for :for' do
          inspect_source(cop, ['[:for, :ala, :bala]'])
          expect(cop.offences).to be_empty
        end

        it 'does not register an offence for def for' do
          inspect_source(cop, ['def for; end'])
          expect(cop.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/style/for_spec.rb
rubocop-0.13.0 spec/rubocop/cop/style/for_spec.rb