Sha256: 797751b9accac85cec46fbb135e51f06c2fe0e8deeadc9274e44dec90461c72e

Contents?: true

Size: 548 Bytes

Versions: 5

Compression:

Stored size: 548 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  it 'registers an offence for a Proc.new call' do
    inspect_source(cop, ['f = Proc.new { |x| puts x }'])
    expect(cop.offences.size).to eq(1)
  end

  it 'accepts the proc method' do
    inspect_source(cop, ['f = proc { |x| puts x }'])
    expect(cop.offences).to be_empty
  end

  it 'accepts the Proc.new call outside of block' do
    inspect_source(cop, ['p = Proc.new'])
    expect(cop.offences).to be_empty
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-0.17.0 spec/rubocop/cop/style/proc_spec.rb
rubocop-0.16.0 spec/rubocop/cop/style/proc_spec.rb
rubocop-0.15.0 spec/rubocop/cop/style/proc_spec.rb
rubocop-0.14.1 spec/rubocop/cop/style/proc_spec.rb
rubocop-0.14.0 spec/rubocop/cop/style/proc_spec.rb