Sha256: 3a3d499a13d1e19ec2033800358d3839881366f7f529c78b26cb6a0ca710fd03

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    describe ArrayLiteral do
      let(:a) { ArrayLiteral.new }

      it 'registers an offence for Array.new()' do
        inspect_source(a,
                       'file.rb',
                       ['test = Array.new()'])
        expect(a.offences.size).to eq(1)
        expect(a.offences.map(&:message))
          .to eq([ArrayLiteral::ERROR_MESSAGE])
      end

      it 'registers an offence for Array.new'

      it 'does not register an offence for Array.new(3)' do
        inspect_source(a,
                       'file.rb',
                       ['test = Array.new(3)'])
        expect(a.offences).to be_empty
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-0.6.0 spec/rubocop/cops/array_literal_spec.rb