summaryrefslogtreecommitdiff
path: root/spec/support/helpers/expect_offense.rb
blob: 35718ba90c5edd12744ec55b718d51d074f2854e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'rubocop/rspec/support'

# https://github.com/backus/rubocop-rspec/blob/master/spec/support/expect_offense.rb
# rubocop-rspec gem extension of RuboCop's ExpectOffense module.
#
# This mixin is the same as rubocop's ExpectOffense except the default
# filename ends with `_spec.rb`
module ExpectOffense
  include RuboCop::RSpec::ExpectOffense

  DEFAULT_FILENAME = 'example_spec.rb'.freeze

  def expect_offense(source, filename = DEFAULT_FILENAME)
    super
  end

  def expect_no_offenses(source, filename = DEFAULT_FILENAME)
    super
  end
end