Sha256: 3fb54de3fee49282412277ab8fca1e7e4cf311ec68fce576f768d17d81d03861

Contents?: true

Size: 744 Bytes

Versions: 4

Compression:

Stored size: 744 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

      it 'registers an offence for $custom' do
        inspect_source(ap, ['puts $custom'])
        expect(ap.offences.size).to eq(1)
      end

      it 'does not register an offence for $"' do
        inspect_source(ap, ['puts $"'])

        expect(ap.offences).to be_empty
      end

      it 'does not register an offence for $ORS' do
        inspect_source(ap, ['puts $0'])
        expect(ap.offences).to be_empty
      end

      it 'does not register an offence for backrefs like $1' do
        inspect_source(ap, ['puts $1'])
        expect(ap.offences).to be_empty
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.8.3 spec/rubocop/cops/avoid_global_vars_spec.rb
rubocop-0.8.2 spec/rubocop/cops/avoid_global_vars_spec.rb
rubocop-0.8.1 spec/rubocop/cops/avoid_global_vars_spec.rb
rubocop-0.8.0 spec/rubocop/cops/avoid_global_vars_spec.rb