1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
# frozen_string_literal: true
# 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`
#
# Cops assigned to departments may focus on different files, so it is
# possible to override the inspected file name.
module ExpectOffense
include RuboCop::RSpec::ExpectOffense
DEFAULT_FILENAME = 'example_spec.rb'
def expect_offense(source, filename = inspected_source_filename,
*args, **kwargs)
super
end
def expect_no_offenses(source, filename = inspected_source_filename)
super
end
def inspected_source_filename
DEFAULT_FILENAME
end
end
|