Sha256: 2da24d60d73acc840201475b3abf2fda29d7575d138bee3d11a775a976d3f3ad

Contents?: true

Size: 584 Bytes

Versions: 8

Compression:

Stored size: 584 Bytes

Contents

# encoding: utf-8

RSpec::Matchers.define :find_offenses_in do |code|
  match do |cop|
    inspect_source(cop, [code])
    includes_highlight(cop) &&
      includes_message(cop) &&
      cop.offenses.any?
  end

  chain :with_highlight do |highlight|
    @highlight = highlight
  end

  chain :with_message do |message|
    @message = message
  end

  def includes_highlight(cop)
    return true unless @highlight

    cop.highlights.include?(@highlight)
  end

  def includes_message(cop)
    return true unless @message

    cop.offenses.map(&:message).include?(@message)
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
rubyjobbuilderdsl-0.0.2 vendor/bundle/ruby/2.1.0/gems/rubocop-0.26.0/spec/support/offenses_matcher.rb
rubyjobbuilderdsl-0.0.1 vendor/bundle/ruby/2.1.0/gems/rubocop-0.26.0/spec/support/offenses_matcher.rb
rubocop-0.26.1 spec/support/offenses_matcher.rb
rubocop-0.26.0 spec/support/offenses_matcher.rb
rubocop-0.25.0 spec/support/offenses_matcher.rb
rubocop-0.24.1 spec/support/offenses_matcher.rb
rubocop-0.24.0 spec/support/offenses_matcher.rb
rubocop-0.23.0 spec/support/offenses_matcher.rb