Sha256: df4c9cbe705ad27b00af44ffd50dc093ea57d0b257f057b544adcd175160f466

Contents?: true

Size: 964 Bytes

Versions: 4

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 offense for a debugger call' do
    src = ['debugger']
    inspect_source(cop, src)
    expect(cop.offenses.size).to eq(1)
  end

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

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

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.20.1 spec/rubocop/cop/lint/debugger_spec.rb
rubocop-0.20.0 spec/rubocop/cop/lint/debugger_spec.rb
rubocop-0.19.1 spec/rubocop/cop/lint/debugger_spec.rb
rubocop-0.19.0 spec/rubocop/cop/lint/debugger_spec.rb