Sha256: 31837832379c9e425e2baaae1001eebd51ab6e9deeca918d50b78980fb75d425

Contents?: true

Size: 709 Bytes

Versions: 1

Compression:

Stored size: 709 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

      it 'registers an offence for Hash.new'

      it 'does not register an offence for Hash.new(3)' do
        inspect_source(a,
                       'file.rb',
                       ['test = Hash.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/hash_literal_spec.rb