Sha256: 1be839962363c808705747f1f4b112e9cda9401274be3f220abe424cdd2b82c1

Contents?: true

Size: 519 Bytes

Versions: 2

Compression:

Stored size: 519 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

        it 'auto-corrects $1 to Regexp.last_match[1]' do
          new_source = autocorrect_source(cop, '$1')
          expect(new_source).to eq('Regexp.last_match[1]')
        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/perl_backrefs_spec.rb
rubocop-0.13.0 spec/rubocop/cop/style/perl_backrefs_spec.rb