Sha256: 419e2aaec74030cb6affdca0bb082a326059cbaac4f7d0cb19e5805383cc36a3

Contents?: true

Size: 878 Bytes

Versions: 7

Compression:

Stored size: 878 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    describe AvoidPerlisms do
      let(:ap) { AvoidPerlisms.new }

      it 'registers an offence for $:' do
        inspect_source(ap, 'file.rb', ['puts $:'])
        expect(ap.offences.size).to eq(1)
        expect(ap.offences.map(&:message))
          .to eq(['Prefer $LOAD_PATH over $:.'])
      end

      it 'registers an offence for $"' do
        inspect_source(ap, 'file.rb', ['puts $"'])
        expect(ap.offences.size).to eq(1)
        expect(ap.offences.map(&:message))
          .to eq(['Prefer $LOADED_FEATURES over $".'])
      end

      it 'registers an offence for $0' do
        inspect_source(ap, 'file.rb', ['puts $0'])
        expect(ap.offences.size).to eq(1)
        expect(ap.offences.map(&:message))
          .to eq(['Prefer $PROGRAM_NAME over $0.'])
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubocop-0.5.0 spec/rubocop/cops/avoid_perlisms_spec.rb
rubocop-0.4.6 spec/rubocop/cops/avoid_perlisms_spec.rb
rubocop-0.4.5 spec/rubocop/cops/avoid_perlisms_spec.rb
rubocop-0.4.4 spec/rubocop/cops/avoid_perlisms_spec.rb
rubocop-0.4.3 spec/rubocop/cops/avoid_perlisms_spec.rb
rubocop-0.4.2 spec/rubocop/cops/avoid_perlisms_spec.rb
rubocop-0.4.1 spec/rubocop/cops/avoid_perlisms_spec.rb