Sha256: 7c00f87e207771520d986f951c703fdc249ad8fa649e4927318cea65df2990cf

Contents?: true

Size: 964 Bytes

Versions: 8

Compression:

Stored size: 964 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Rubocop::Cop::Lint::Debugger do
  subject(:cop) { described_class.new  }

  it 'reports an offence for a debugger call' do
    src = ['debugger']
    inspect_source(cop, src)
    expect(cop.offences.size).to eq(1)
  end

  it 'reports an offence for pry bindings' do
    src = ['binding.pry',
           'binding.remote_pry']
    inspect_source(cop, src)
    expect(cop.offences.size).to eq(2)
  end

  it 'does not report an offence for non-pry binding' do
    src = ['binding.pirate']
    inspect_source(cop, src)
    expect(cop.offences).to be_empty
  end

  it 'does not report an offence for debugger in comments' do
    src = ['# debugger']
    inspect_source(cop, src)
    expect(cop.offences).to be_empty
  end

  it 'does not report an offence for a debugger or pry method' do
    src = ['code.debugger',
           'door.pry']
    inspect_source(cop, src)
    expect(cop.offences).to be_empty
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
ridecharge-rubocop-0.0.1 spec/rubocop/cop/lint/debugger_spec.rb
rubocop-0.18.1 spec/rubocop/cop/lint/debugger_spec.rb
rubocop-0.18.0 spec/rubocop/cop/lint/debugger_spec.rb
rubocop-0.17.0 spec/rubocop/cop/lint/debugger_spec.rb
rubocop-0.16.0 spec/rubocop/cop/lint/debugger_spec.rb
rubocop-0.15.0 spec/rubocop/cop/lint/debugger_spec.rb
rubocop-0.14.1 spec/rubocop/cop/lint/debugger_spec.rb
rubocop-0.14.0 spec/rubocop/cop/lint/debugger_spec.rb