lib/rubocop/minitest/assert_offense.rb in rubocop-minitest-0.26.1 vs lib/rubocop/minitest/assert_offense.rb in rubocop-minitest-0.27.0
- old
+ new
@@ -8,11 +8,11 @@
module Minitest
# Mixin for `assert_offense` and `assert_no_offenses`
#
# This mixin makes it easier to specify strict offense assertions
# in a declarative and visual fashion. Just type out the code that
- # should generate a offense, annotate code by writing '^'s
+ # should generate an offense, annotate code by writing '^'s
# underneath each character that should be highlighted, and follow
# the carets with a string (separated by a space) that is the
# message of the offense. You can include multiple offenses in
# one code snippet.
#
@@ -75,9 +75,10 @@
module AssertOffense
private
def setup
cop_name = self.class.to_s.delete_suffix('Test')
+ return unless RuboCop::Cop::Minitest.const_defined?(cop_name)
@cop = RuboCop::Cop::Minitest.const_get(cop_name).new
end
def format_offense(source, **replacements)