diff --git a/README.md b/README.md index 5b8f3e61..afe13e00 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,89 @@ Here are the Markdown snippets for the two badges: [![Minitest Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://minitest.rubystyle.guide) ``` +## Using this Gem for testing custom cops + +You can use this gem to test your own cops, by using the `RuboCop::Minitest::Test` test class, you'll get `assert_offense`, `assert_correction`, and `assert_no_offense` helpers + +```ruby + +require "rubocop/minitest/support" +require "custom_cops/my_cop" + +module CustomCops + class MyCopTest < RuboCop::Minitest::Test + def test_registers_offense + assert_offense(<<~RUBY) + class FooTest < Minitest::Test + def test_do_something + assert_equal(nil, somestuff) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `assert_nil(somestuff)`. + end + end + RUBY + end + + def test_assert_offense_and_correction + assert_offense(<<~RUBY) + class FooTest < Minitest::Test + def test_do_something + assert_equal(nil, somestuff) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `assert_nil(somestuff)`. + end + end + RUBY + + assert_correction(<<~RUBY) + class FooTest < Minitest::Test + def test_do_something + assert_nil(somestuff) + end + end + RUBY + end + + def test_assert_offense_and_no_corrections + assert_offense(<<~RUBY) + class FooTest < Minitest::Test + def test_do_something + assert_equal(nil, somestuff) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `assert_nil(somestuff)`. + end + end + RUBY + + assert_no_corrections + end + + def test_assert_no_offense + assert_no_offenses(<<~RUBY) + class FooTest < Minitest::Test + def test_do_something + assert_nil(somestuff) + end + end + RUBY + end + + # You can set the `@cop` attribute to override the auto-detected cop and provide configuration options + def test_override_cop_configuration + cop_config = RuboCop::Config.new('Minitest/MultipleAssertions' => { 'Max' => 1 }) + @cop = RuboCop::Cop::Minitest::MultipleAssertions.new(cop_config) + + assert_offense(<<~RUBY) + class FooTest < Minitest::Test + def test_asserts_twice + ^^^^^^^^^^^^^^^^^^^^^^ Test case has too many assertions [2/1]. + assert_equal(foo, bar) + assert_empty(array) + end + end + RUBY + end + end +end +``` + ## Contributing Checkout the [contribution guidelines](CONTRIBUTING.md). diff --git a/changelog/new_make_test_class_reusable_by_consumers.md b/changelog/new_make_test_class_reusable_by_consumers.md new file mode 100644 index 00000000..d96141d9 --- /dev/null +++ b/changelog/new_make_test_class_reusable_by_consumers.md @@ -0,0 +1 @@ +* [#278](https://github.com/rubocop/rubocop-minitest/pull/278): Allow `RuboCop::Minitest::Test` to be used by consumers of the gem to test custom cops. ([@dougedey][]) diff --git a/lib/rubocop/minitest/assert_offense.rb b/lib/rubocop/minitest/assert_offense.rb deleted file mode 100644 index 8bd5be60..00000000 --- a/lib/rubocop/minitest/assert_offense.rb +++ /dev/null @@ -1,224 +0,0 @@ -# frozen_string_literal: true - -# Laziness copied from rubocop source code -require 'rubocop/rspec/expect_offense' -require 'rubocop/cop/legacy/corrector' - -module RuboCop - 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 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. - # - # @example Usage - # - # assert_offense(<<~RUBY) - # class FooTest < Minitest::Test - # def test_do_something - # assert_equal(nil, somestuff) - # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `assert_nil(somestuff)`. - # end - # end - # RUBY - # - # Autocorrection can be tested using `assert_correction` after - # `assert_offense`. - # - # @example `assert_offense` and `assert_correction` - # - # assert_offense(<<~RUBY) - # class FooTest < Minitest::Test - # def test_do_something - # assert_equal(nil, somestuff) - # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `assert_nil(somestuff)`. - # end - # end - # RUBY - # - # assert_correction(<<~RUBY) - # class FooTest < Minitest::Test - # def test_do_something - # assert_nil(somestuff) - # end - # end - # RUBY - # - # If you do not want to specify an offense then use the - # companion method `assert_no_offenses`. This method is a much - # simpler assertion since it just inspects the source and checks - # that there were no offenses. The `assert_offense` method has - # to do more work by parsing out lines that contain carets. - # - # If the code produces an offense that could not be autocorrected, you can - # use `assert_no_corrections` after `assert_offense`. - # - # @example `assert_offense` and `assert_no_corrections` - # - # assert_offense(<<~RUBY) - # class FooTest < Minitest::Test - # def test_do_something - # assert_equal(nil, somestuff) - # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `assert_nil(somestuff)`. - # end - # end - # RUBY - # - # assert_no_corrections - # - # rubocop:disable Metrics/ModuleLength - 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(configuration) - end - - def format_offense(source, **replacements) - replacements.each do |keyword, value| - value = value.to_s - source = source.gsub("%{#{keyword}}", value) - .gsub("^{#{keyword}}", '^' * value.size) - .gsub("_{#{keyword}}", ' ' * value.size) - end - source - end - - def assert_no_offenses(source, file = nil) - setup_assertion - - offenses = inspect_source(source, @cop, file) - - expected_annotations = RuboCop::RSpec::ExpectOffense::AnnotatedSource.parse(source) - actual_annotations = expected_annotations.with_offense_annotations(offenses) - - assert_equal(source, actual_annotations.to_s) - end - - def assert_offense(source, file = nil, **replacements) - setup_assertion - - @cop.instance_variable_get(:@options)[:autocorrect] = true - - source = format_offense(source, **replacements) - expected_annotations = RuboCop::RSpec::ExpectOffense::AnnotatedSource.parse(source) - if expected_annotations.plain_source == source - raise 'Use `assert_no_offenses` to assert that no offenses are found' - end - - @processed_source = parse_source!(expected_annotations.plain_source, file) - - offenses = _investigate(@cop, @processed_source) - - actual_annotations = expected_annotations.with_offense_annotations(offenses) - - assert_equal(expected_annotations.to_s, actual_annotations.to_s) - end - - def _investigate(cop, processed_source) - team = RuboCop::Cop::Team.new([cop], configuration, raise_error: true) - report = team.investigate(processed_source) - @last_corrector = report.correctors.first || RuboCop::Cop::Corrector.new(processed_source) - report.offenses - end - - def assert_correction(correction, loop: true) - raise '`assert_correction` must follow `assert_offense`' unless @processed_source - - iteration = 0 - new_source = loop do - iteration += 1 - - corrected_source = @last_corrector.rewrite - - break corrected_source unless loop - break corrected_source if @last_corrector.empty? || corrected_source == @processed_source.buffer.source - - if iteration > RuboCop::Runner::MAX_ITERATIONS - raise RuboCop::Runner::InfiniteCorrectionLoop.new(@processed_source.path, []) - end - - # Prepare for next loop - @processed_source = parse_source!(corrected_source, @processed_source.path) - - _investigate(@cop, @processed_source) - end - - assert_equal(correction, new_source) - end - - def setup_assertion - RuboCop::Formatter::DisabledConfigFormatter.config_to_allow_offenses = {} - RuboCop::Formatter::DisabledConfigFormatter.detected_styles = {} - end - - def inspect_source(source, cop, file = nil) - processed_source = parse_source!(source, file) - raise 'Error parsing example code' unless processed_source.valid_syntax? - - _investigate(cop, processed_source) - end - - def investigate(cop, processed_source) - needed = Hash.new { |h, k| h[k] = [] } - Array(cop.class.joining_forces).each { |force| needed[force] << cop } - forces = needed.map do |force_class, joining_cops| - force_class.new(joining_cops) - end - - commissioner = RuboCop::Cop::Commissioner.new([cop], forces, raise_error: true) - commissioner.investigate(processed_source) - commissioner - end - - def parse_source!(source, file = nil) - if file.respond_to?(:write) - file.write(source) - file.rewind - file = file.path - end - - processed_source = RuboCop::ProcessedSource.new(source, ruby_version, file) - - # Follow up https://github.com/rubocop/rubocop/pull/10987. - # When support for RuboCop 1.37.1 ends, this condition can be removed. - if processed_source.respond_to?(:config) && processed_source.respond_to?(:registry) - processed_source.config = configuration - processed_source.registry = registry - end - - processed_source - end - - def configuration - @configuration ||= if defined?(config) - config - else - RuboCop::Config.new({}, "#{Dir.pwd}/.rubocop.yml") - end - end - - def registry - @registry ||= begin - cops = configuration.keys.map { |cop| RuboCop::Cop::Registry.global.find_by_cop_name(cop) } - cops << cop_class if defined?(cop_class) && !cops.include?(cop_class) - cops.compact! - RuboCop::Cop::Registry.new(cops) - end - end - - def ruby_version - RuboCop::TargetRuby::DEFAULT_VERSION - end - end - # rubocop:enable Metrics/ModuleLength - end -end diff --git a/lib/rubocop/minitest/support.rb b/lib/rubocop/minitest/support.rb index 1c3030d7..8c0701f8 100644 --- a/lib/rubocop/minitest/support.rb +++ b/lib/rubocop/minitest/support.rb @@ -1,10 +1,247 @@ # frozen_string_literal: true # Require this file to load code that supports testing using Minitest. +# rubocop:disable Metrics/ClassLength require 'rubocop' -require 'minitest/autorun' -require 'minitest/pride' -require_relative 'assert_offense' +require 'rubocop/rspec/expect_offense' +require 'rubocop/cop/legacy/corrector' -Minitest::Test.include RuboCop::Minitest::AssertOffense +module RuboCop + module Minitest + # Minitest base test class that adds `assert_offense` and `assert_no_offenses` + # + # This test class makes it easier to specify strict offense assertions + # in a declarative and visual fashion. Just type out the code that + # 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. + # + # @example Usage + # + # class AssertNilTest < RuboCop::Minitest::Test + # def test_fails_when_using_assert_equal_nil + # assert_offense(<<~RUBY) + # class FooTest < Minitest::Test + # def test_do_something + # assert_equal(nil, somestuff) + # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `assert_nil(somestuff)`. + # end + # end + # RUBY + # end + # end + # + # Autocorrection can be tested using `assert_correction` after + # `assert_offense`. + # + # @example `assert_offense` and `assert_correction` + # + # class AssertNilTest < RuboCop::Minitest::Test + # def test_autocorrects_when_using_assert_equal + # assert_offense(<<~RUBY) + # class FooTest < Minitest::Test + # def test_do_something + # assert_equal(nil, somestuff) + # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `assert_nil(somestuff)`. + # end + # RUBY + # + # assert_correction(<<~RUBY) + # class FooTest < Minitest::Test + # def test_do_something + # assert_nil(somestuff) + # end + # end + # RUBY + # end + # end + # end + # + # If you do not want to specify an offense then use the + # companion method `assert_no_offenses`. This method is a much + # simpler assertion since it just inspects the source and checks + # that there were no offenses. The `assert_offense` method has + # to do more work by parsing out lines that contain carets. + # + # If the code produces an offense that could not be autocorrected, you can + # use `assert_no_corrections` after `assert_offense`. + # + # @example `assert_offense` and `assert_no_corrections` + # + # class AssertNilTest < RuboCop::Minitest::Test + # def test_no_autocorrections + # assert_offense(<<~RUBY) + # class FooTest < Minitest::Test + # def test_do_something + # assert_equal(nil, somestuff) + # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `assert_nil(somestuff)`. + # end + # end + # RUBY + # + # assert_no_corrections + # end + # end + class Test < ::Minitest::Test + private + + def setup + cop_name = self.class.to_s.delete_suffix('Test') + + cop_class = begin + Object.const_get("RuboCop::Cop::Minitest::#{cop_name}") + rescue NameError # rubocop:disable Lint/SuppressedException + end + + cop_class ||= begin + Object.const_get(cop_name) + rescue NameError # rubocop:disable Lint/SuppressedException + end + + @cop = cop_class.new(configuration) if cop_class&.ancestors&.include?(RuboCop::Cop::Base) + end + + def format_offense(source, **replacements) + replacements.each do |keyword, value| + value = value.to_s + source = source.gsub("%{#{keyword}}", value) + .gsub("^{#{keyword}}", '^' * value.size) + .gsub("_{#{keyword}}", ' ' * value.size) + end + source + end + + def assert_no_offenses(source, file = nil) + setup_assertion + + offenses = inspect_source(source, @cop, file) + + expected_annotations = RuboCop::RSpec::ExpectOffense::AnnotatedSource.parse(source) + actual_annotations = expected_annotations.with_offense_annotations(offenses) + + assert_equal(source, actual_annotations.to_s) + end + + def assert_offense(source, file = nil, **replacements) + setup_assertion + + @cop.instance_variable_get(:@options)[:autocorrect] = true + + source = format_offense(source, **replacements) + expected_annotations = RuboCop::RSpec::ExpectOffense::AnnotatedSource.parse(source) + if expected_annotations.plain_source == source + raise 'Use `assert_no_offenses` to assert that no offenses are found' + end + + @processed_source = parse_source!(expected_annotations.plain_source, file) + + offenses = _investigate(@cop, @processed_source) + + actual_annotations = expected_annotations.with_offense_annotations(offenses) + + assert_equal(expected_annotations.to_s, actual_annotations.to_s) + end + + def _investigate(cop, processed_source) + team = RuboCop::Cop::Team.new([cop], configuration, raise_error: true) + report = team.investigate(processed_source) + @last_corrector = report.correctors.first || RuboCop::Cop::Corrector.new(processed_source) + report.offenses + end + + def assert_correction(correction, loop: true) + raise '`assert_correction` must follow `assert_offense`' unless @processed_source + + iteration = 0 + new_source = loop do + iteration += 1 + + corrected_source = @last_corrector.rewrite + + break corrected_source unless loop + break corrected_source if @last_corrector.empty? || corrected_source == @processed_source.buffer.source + + if iteration > RuboCop::Runner::MAX_ITERATIONS + raise RuboCop::Runner::InfiniteCorrectionLoop.new(@processed_source.path, []) + end + + # Prepare for next loop + @processed_source = parse_source!(corrected_source, @processed_source.path) + + _investigate(@cop, @processed_source) + end + + assert_equal(correction, new_source) + end + + def setup_assertion + RuboCop::Formatter::DisabledConfigFormatter.config_to_allow_offenses = {} + RuboCop::Formatter::DisabledConfigFormatter.detected_styles = {} + raise('Could not autodetect cop.') if @cop.nil? + end + + def inspect_source(source, cop, file = nil) + processed_source = parse_source!(source, file) + raise 'Error parsing example code' unless processed_source.valid_syntax? + + _investigate(cop, processed_source) + end + + def investigate(cop, processed_source) + needed = Hash.new { |h, k| h[k] = [] } + Array(cop.class.joining_forces).each { |force| needed[force] << cop } + forces = needed.map do |force_class, joining_cops| + force_class.new(joining_cops) + end + + commissioner = RuboCop::Cop::Commissioner.new([cop], forces, raise_error: true) + commissioner.investigate(processed_source) + commissioner + end + + def parse_source!(source, file = nil) + if file.respond_to?(:write) + file.write(source) + file.rewind + file = file.path + end + + processed_source = RuboCop::ProcessedSource.new(source, ruby_version, file) + + # Follow up https://github.com/rubocop/rubocop/pull/10987. + # When support for RuboCop 1.37.1 ends, this condition can be removed. + if processed_source.respond_to?(:config) && processed_source.respond_to?(:registry) + processed_source.config = configuration + processed_source.registry = registry + end + + processed_source + end + + def configuration + @configuration ||= if defined?(config) + config + else + RuboCop::Config.new({}, "#{Dir.pwd}/.rubocop.yml") + end + end + + def registry + @registry ||= begin + cops = configuration.keys.map { |cop| RuboCop::Cop::Registry.global.find_by_cop_name(cop) } + cops << cop_class if defined?(cop_class) && !cops.include?(cop_class) + cops.compact! + RuboCop::Cop::Registry.new(cops) + end + end + + def ruby_version + RuboCop::TargetRuby::DEFAULT_VERSION + end + end + end +end +# rubocop:enable Metrics/ClassLength diff --git a/test/project_test.rb b/test/project_test.rb index 82648ff1..9e607a95 100644 --- a/test/project_test.rb +++ b/test/project_test.rb @@ -2,7 +2,7 @@ require_relative 'test_helper' -class ProjectTest < Minitest::Test +class ProjectTest < RuboCop::Minitest::Test def setup @issues = [] @bodies = [] diff --git a/test/rubocop/cop/minitest/assert_empty_literal_test.rb b/test/rubocop/cop/minitest/assert_empty_literal_test.rb index 12527982..74ad7391 100644 --- a/test/rubocop/cop/minitest/assert_empty_literal_test.rb +++ b/test/rubocop/cop/minitest/assert_empty_literal_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertEmptyLiteralTest < Minitest::Test +class AssertEmptyLiteralTest < RuboCop::Minitest::Test def test_registers_offense_when_asserting_empty_array assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_empty_test.rb b/test/rubocop/cop/minitest/assert_empty_test.rb index 25b1e7f3..79cc8326 100644 --- a/test/rubocop/cop/minitest/assert_empty_test.rb +++ b/test/rubocop/cop/minitest/assert_empty_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertEmptyTest < Minitest::Test +class AssertEmptyTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_with_empty assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_equal_test.rb b/test/rubocop/cop/minitest/assert_equal_test.rb index 26762617..216a69c2 100644 --- a/test/rubocop/cop/minitest/assert_equal_test.rb +++ b/test/rubocop/cop/minitest/assert_equal_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertEqualTest < Minitest::Test +class AssertEqualTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_equal_operator_with_string assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_in_delta_test.rb b/test/rubocop/cop/minitest/assert_in_delta_test.rb index 443252a8..a1c2fc88 100644 --- a/test/rubocop/cop/minitest/assert_in_delta_test.rb +++ b/test/rubocop/cop/minitest/assert_in_delta_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertInDeltaTest < Minitest::Test +class AssertInDeltaTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_equal_with_float_as_expected_value assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_includes_test.rb b/test/rubocop/cop/minitest/assert_includes_test.rb index 7f6d6fb2..79db3c0a 100644 --- a/test/rubocop/cop/minitest/assert_includes_test.rb +++ b/test/rubocop/cop/minitest/assert_includes_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertIncludesTest < Minitest::Test +class AssertIncludesTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_with_include assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_instance_of_test.rb b/test/rubocop/cop/minitest/assert_instance_of_test.rb index fff90e7b..e46e6377 100644 --- a/test/rubocop/cop/minitest/assert_instance_of_test.rb +++ b/test/rubocop/cop/minitest/assert_instance_of_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertInstanceOfTest < Minitest::Test +class AssertInstanceOfTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_with_instance_of assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_kind_of_test.rb b/test/rubocop/cop/minitest/assert_kind_of_test.rb index ae89c200..71803d75 100644 --- a/test/rubocop/cop/minitest/assert_kind_of_test.rb +++ b/test/rubocop/cop/minitest/assert_kind_of_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertKindOfTest < Minitest::Test +class AssertKindOfTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_with_kind_of assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_match_test.rb b/test/rubocop/cop/minitest/assert_match_test.rb index dce3e9dc..4c4c75d6 100644 --- a/test/rubocop/cop/minitest/assert_match_test.rb +++ b/test/rubocop/cop/minitest/assert_match_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertMatchTest < Minitest::Test +class AssertMatchTest < RuboCop::Minitest::Test %i[match match? =~].each do |matcher| define_method("test_registers_offense_when_using_assert_with_#{matcher}") do assert_offense(<<~RUBY, matcher: matcher) diff --git a/test/rubocop/cop/minitest/assert_nil_test.rb b/test/rubocop/cop/minitest/assert_nil_test.rb index a1e2d9b6..a320fe91 100644 --- a/test/rubocop/cop/minitest/assert_nil_test.rb +++ b/test/rubocop/cop/minitest/assert_nil_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertNilTest < Minitest::Test +class AssertNilTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_equal_with_nil assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_operator_test.rb b/test/rubocop/cop/minitest/assert_operator_test.rb index 31d2cc53..d941fa3e 100644 --- a/test/rubocop/cop/minitest/assert_operator_test.rb +++ b/test/rubocop/cop/minitest/assert_operator_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertOperatorTest < Minitest::Test +class AssertOperatorTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_with_operator_method assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_output_test.rb b/test/rubocop/cop/minitest/assert_output_test.rb index 4484427a..2aa36720 100644 --- a/test/rubocop/cop/minitest/assert_output_test.rb +++ b/test/rubocop/cop/minitest/assert_output_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertOutputTest < Minitest::Test +class AssertOutputTest < RuboCop::Minitest::Test def test_registers_offense_when_mutating_output_global_variable assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_path_exists_test.rb b/test/rubocop/cop/minitest/assert_path_exists_test.rb index f990b29c..33c229c1 100644 --- a/test/rubocop/cop/minitest/assert_path_exists_test.rb +++ b/test/rubocop/cop/minitest/assert_path_exists_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertPathExistsTest < Minitest::Test +class AssertPathExistsTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_file_exist assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_predicate_test.rb b/test/rubocop/cop/minitest/assert_predicate_test.rb index 8c4fe557..057d9387 100644 --- a/test/rubocop/cop/minitest/assert_predicate_test.rb +++ b/test/rubocop/cop/minitest/assert_predicate_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertPredicateTest < Minitest::Test +class AssertPredicateTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_with_predicate_method assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_raises_compound_body_test.rb b/test/rubocop/cop/minitest/assert_raises_compound_body_test.rb index 1128c6e3..2116857c 100644 --- a/test/rubocop/cop/minitest/assert_raises_compound_body_test.rb +++ b/test/rubocop/cop/minitest/assert_raises_compound_body_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertRaisesCompoundBodyTest < Minitest::Test +class AssertRaisesCompoundBodyTest < RuboCop::Minitest::Test def test_registers_offense_when_multi_statement_bodies assert_offense(<<~RUBY) assert_raises(MyError) do diff --git a/test/rubocop/cop/minitest/assert_raises_with_regexp_argument_test.rb b/test/rubocop/cop/minitest/assert_raises_with_regexp_argument_test.rb index 1483f303..f1e750db 100644 --- a/test/rubocop/cop/minitest/assert_raises_with_regexp_argument_test.rb +++ b/test/rubocop/cop/minitest/assert_raises_with_regexp_argument_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertRaisesWithRegexpArgumentTest < Minitest::Test +class AssertRaisesWithRegexpArgumentTest < RuboCop::Minitest::Test def test_registers_offense_with_regexp assert_offense(<<~RUBY) assert_raises(MyError, /some message/) do diff --git a/test/rubocop/cop/minitest/assert_respond_to_test.rb b/test/rubocop/cop/minitest/assert_respond_to_test.rb index 2c9c6ebf..b7d1681e 100644 --- a/test/rubocop/cop/minitest/assert_respond_to_test.rb +++ b/test/rubocop/cop/minitest/assert_respond_to_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertRespondToTest < Minitest::Test +class AssertRespondToTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_calling_respond_to_method assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_same_test.rb b/test/rubocop/cop/minitest/assert_same_test.rb index 3badd569..4f4f6951 100644 --- a/test/rubocop/cop/minitest/assert_same_test.rb +++ b/test/rubocop/cop/minitest/assert_same_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertSameTest < Minitest::Test +class AssertSameTest < RuboCop::Minitest::Test def test_registers_offense_when_using_equal assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_silent_test.rb b/test/rubocop/cop/minitest/assert_silent_test.rb index 6fbed4a3..82a340ab 100644 --- a/test/rubocop/cop/minitest/assert_silent_test.rb +++ b/test/rubocop/cop/minitest/assert_silent_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertSilentTest < Minitest::Test +class AssertSilentTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_output_with_empty_strings assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_truthy_test.rb b/test/rubocop/cop/minitest/assert_truthy_test.rb index b2b39ff9..252fdc3a 100644 --- a/test/rubocop/cop/minitest/assert_truthy_test.rb +++ b/test/rubocop/cop/minitest/assert_truthy_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertTruthyTest < Minitest::Test +class AssertTruthyTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_equal_with_true assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assert_with_expected_argument_test.rb b/test/rubocop/cop/minitest/assert_with_expected_argument_test.rb index 73bb75a7..85d6bf37 100644 --- a/test/rubocop/cop/minitest/assert_with_expected_argument_test.rb +++ b/test/rubocop/cop/minitest/assert_with_expected_argument_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertWithExpectedArgumentTest < Minitest::Test +class AssertWithExpectedArgumentTest < RuboCop::Minitest::Test def test_registers_offense_when_second_argument_is_not_a_string assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/assertion_in_lifecycle_hook_test.rb b/test/rubocop/cop/minitest/assertion_in_lifecycle_hook_test.rb index 7d075b48..5311cba6 100644 --- a/test/rubocop/cop/minitest/assertion_in_lifecycle_hook_test.rb +++ b/test/rubocop/cop/minitest/assertion_in_lifecycle_hook_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class AssertionInLifecycleHookTest < Minitest::Test +class AssertionInLifecycleHookTest < RuboCop::Minitest::Test def test_registers_offense_when_using_bad_method assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/duplicate_test_run_test.rb b/test/rubocop/cop/minitest/duplicate_test_run_test.rb index 03fee195..3ac26407 100644 --- a/test/rubocop/cop/minitest/duplicate_test_run_test.rb +++ b/test/rubocop/cop/minitest/duplicate_test_run_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class DuplicateTestRunTest < Minitest::Test +class DuplicateTestRunTest < RuboCop::Minitest::Test def test_registers_offense_when_parent_and_child_have_tests_methods assert_offense(<<~RUBY) class ParentTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/empty_line_before_assertion_methods_test.rb b/test/rubocop/cop/minitest/empty_line_before_assertion_methods_test.rb index 49d4d1cd..d215ce20 100644 --- a/test/rubocop/cop/minitest/empty_line_before_assertion_methods_test.rb +++ b/test/rubocop/cop/minitest/empty_line_before_assertion_methods_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class EmptyLineBeforeAssertionMethodsTest < Minitest::Test +class EmptyLineBeforeAssertionMethodsTest < RuboCop::Minitest::Test def test_registers_offense_when_using_method_call_before_assertion_method assert_offense(<<~RUBY) def test_do_something diff --git a/test/rubocop/cop/minitest/global_expectations_test.rb b/test/rubocop/cop/minitest/global_expectations_test.rb index 3d73e956..97b11ae6 100644 --- a/test/rubocop/cop/minitest/global_expectations_test.rb +++ b/test/rubocop/cop/minitest/global_expectations_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class GlobalExpectationsTest < Minitest::Test +class GlobalExpectationsTest < RuboCop::Minitest::Test def setup configure_enforced_style(style) end diff --git a/test/rubocop/cop/minitest/lifecycle_hooks_order_test.rb b/test/rubocop/cop/minitest/lifecycle_hooks_order_test.rb index 5dcbb82f..92dfe61a 100644 --- a/test/rubocop/cop/minitest/lifecycle_hooks_order_test.rb +++ b/test/rubocop/cop/minitest/lifecycle_hooks_order_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class LifecycleHooksOrderTest < Minitest::Test +class LifecycleHooksOrderTest < RuboCop::Minitest::Test def test_registers_offense_when_hooks_are_not_correctly_ordered assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/literal_as_actual_argument_test.rb b/test/rubocop/cop/minitest/literal_as_actual_argument_test.rb index 6519336e..dfd243c2 100644 --- a/test/rubocop/cop/minitest/literal_as_actual_argument_test.rb +++ b/test/rubocop/cop/minitest/literal_as_actual_argument_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class LiteralAsActualArgumentTest < Minitest::Test +class LiteralAsActualArgumentTest < RuboCop::Minitest::Test def test_registers_offense_when_actual_is_basic_literal assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/multiple_assertions_test.rb b/test/rubocop/cop/minitest/multiple_assertions_test.rb index caaa7e9f..796f842b 100644 --- a/test/rubocop/cop/minitest/multiple_assertions_test.rb +++ b/test/rubocop/cop/minitest/multiple_assertions_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class MultipleAssertionsTest < Minitest::Test +class MultipleAssertionsTest < RuboCop::Minitest::Test def setup configure_max_assertions(1) end diff --git a/test/rubocop/cop/minitest/no_assertions_test.rb b/test/rubocop/cop/minitest/no_assertions_test.rb index 9fc3a669..ae6036f0 100644 --- a/test/rubocop/cop/minitest/no_assertions_test.rb +++ b/test/rubocop/cop/minitest/no_assertions_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class NoAssertionsTest < Minitest::Test +class NoAssertionsTest < RuboCop::Minitest::Test def test_registers_offense_when_no_assertions assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/no_test_cases_test.rb b/test/rubocop/cop/minitest/no_test_cases_test.rb index 48d75cc0..0123b1ce 100644 --- a/test/rubocop/cop/minitest/no_test_cases_test.rb +++ b/test/rubocop/cop/minitest/no_test_cases_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class NoTestCases < Minitest::Test +class NoTestCasesTest < RuboCop::Minitest::Test def test_registers_offense_for_empty_test_class assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/non_public_test_method_test.rb b/test/rubocop/cop/minitest/non_public_test_method_test.rb index 29e512df..ddb4af92 100644 --- a/test/rubocop/cop/minitest/non_public_test_method_test.rb +++ b/test/rubocop/cop/minitest/non_public_test_method_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class NonPublicTestMethodTest < Minitest::Test +class NonPublicTestMethodTest < RuboCop::Minitest::Test def test_registers_offense_when_using_private_test_method assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/redundant_message_argument_test.rb b/test/rubocop/cop/minitest/redundant_message_argument_test.rb index cb96b081..271843e8 100644 --- a/test/rubocop/cop/minitest/redundant_message_argument_test.rb +++ b/test/rubocop/cop/minitest/redundant_message_argument_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RedundantMessageArgumentTest < Minitest::Test +class RedundantMessageArgumentTest < RuboCop::Minitest::Test def test_registers_offense_when_using_redundant_message_argument_in_assert assert_offense(<<~RUBY) assert(test, nil) diff --git a/test/rubocop/cop/minitest/refute_empty_test.rb b/test/rubocop/cop/minitest/refute_empty_test.rb index bd452efb..40e3fd71 100644 --- a/test/rubocop/cop/minitest/refute_empty_test.rb +++ b/test/rubocop/cop/minitest/refute_empty_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RefuteEmptyTest < Minitest::Test +class RefuteEmptyTest < RuboCop::Minitest::Test def test_registers_offense_when_using_refute_with_empty assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/refute_equal_test.rb b/test/rubocop/cop/minitest/refute_equal_test.rb index 3201231f..50374d47 100644 --- a/test/rubocop/cop/minitest/refute_equal_test.rb +++ b/test/rubocop/cop/minitest/refute_equal_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RefuteEqualTest < Minitest::Test +class RefuteEqualTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_not_equal_operator_with_string assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/refute_false_test.rb b/test/rubocop/cop/minitest/refute_false_test.rb index ab13cd07..f8acb7f7 100644 --- a/test/rubocop/cop/minitest/refute_false_test.rb +++ b/test/rubocop/cop/minitest/refute_false_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RefuteFalseTest < Minitest::Test +class RefuteFalseTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_equal_with_false assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/refute_in_delta_test.rb b/test/rubocop/cop/minitest/refute_in_delta_test.rb index 65670490..b4bb3148 100644 --- a/test/rubocop/cop/minitest/refute_in_delta_test.rb +++ b/test/rubocop/cop/minitest/refute_in_delta_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RefuteInDeltaTest < Minitest::Test +class RefuteInDeltaTest < RuboCop::Minitest::Test def test_registers_offense_when_using_refute_equal_with_float_as_expected_value assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/refute_includes_test.rb b/test/rubocop/cop/minitest/refute_includes_test.rb index 754cff65..8a26c338 100644 --- a/test/rubocop/cop/minitest/refute_includes_test.rb +++ b/test/rubocop/cop/minitest/refute_includes_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RefuteIncludesTest < Minitest::Test +class RefuteIncludesTest < RuboCop::Minitest::Test def test_registers_offense_when_using_refute_with_include assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/refute_instance_of_test.rb b/test/rubocop/cop/minitest/refute_instance_of_test.rb index f576e643..8144251f 100644 --- a/test/rubocop/cop/minitest/refute_instance_of_test.rb +++ b/test/rubocop/cop/minitest/refute_instance_of_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RefuteInstanceOfTest < Minitest::Test +class RefuteInstanceOfTest < RuboCop::Minitest::Test def test_registers_offense_when_using_refute_with_instance_of assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/refute_kind_of_test.rb b/test/rubocop/cop/minitest/refute_kind_of_test.rb index 0014908a..196e4cf0 100644 --- a/test/rubocop/cop/minitest/refute_kind_of_test.rb +++ b/test/rubocop/cop/minitest/refute_kind_of_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RefuteKindOfTest < Minitest::Test +class RefuteKindOfTest < RuboCop::Minitest::Test def test_registers_offense_when_using_refute_with_kind_of assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/refute_match_test.rb b/test/rubocop/cop/minitest/refute_match_test.rb index bd5936f2..664d6e66 100644 --- a/test/rubocop/cop/minitest/refute_match_test.rb +++ b/test/rubocop/cop/minitest/refute_match_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RefuteMatchTest < Minitest::Test +class RefuteMatchTest < RuboCop::Minitest::Test %i[match match? =~].each do |matcher| define_method("test_registers_offense_when_using_refute_with_#{matcher}") do assert_offense(<<~RUBY, matcher: matcher) diff --git a/test/rubocop/cop/minitest/refute_nil_test.rb b/test/rubocop/cop/minitest/refute_nil_test.rb index 348082c7..d4e6e405 100644 --- a/test/rubocop/cop/minitest/refute_nil_test.rb +++ b/test/rubocop/cop/minitest/refute_nil_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RefuteNilTest < Minitest::Test +class RefuteNilTest < RuboCop::Minitest::Test def test_registers_offense_when_using_refute_equal_with_nil assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/refute_operator_test.rb b/test/rubocop/cop/minitest/refute_operator_test.rb index 58a81ef8..00ae4dcb 100644 --- a/test/rubocop/cop/minitest/refute_operator_test.rb +++ b/test/rubocop/cop/minitest/refute_operator_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RefuteOperatorTest < Minitest::Test +class RefuteOperatorTest < RuboCop::Minitest::Test def test_registers_offense_when_using_refute_with_operator_method assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/refute_path_exists_test.rb b/test/rubocop/cop/minitest/refute_path_exists_test.rb index 949d6829..d5131924 100644 --- a/test/rubocop/cop/minitest/refute_path_exists_test.rb +++ b/test/rubocop/cop/minitest/refute_path_exists_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RefutePathExistsTest < Minitest::Test +class RefutePathExistsTest < RuboCop::Minitest::Test def test_registers_offense_when_using_refute_file_exist assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/refute_predicate_test.rb b/test/rubocop/cop/minitest/refute_predicate_test.rb index 83cd099f..1fffed6d 100644 --- a/test/rubocop/cop/minitest/refute_predicate_test.rb +++ b/test/rubocop/cop/minitest/refute_predicate_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RefutePredicateTest < Minitest::Test +class RefutePredicateTest < RuboCop::Minitest::Test def test_registers_offense_when_using_refute_with_predicate_method assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/refute_respond_to_test.rb b/test/rubocop/cop/minitest/refute_respond_to_test.rb index 69b90d20..77dac590 100644 --- a/test/rubocop/cop/minitest/refute_respond_to_test.rb +++ b/test/rubocop/cop/minitest/refute_respond_to_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RefuteRespondToTest < Minitest::Test +class RefuteRespondToTest < RuboCop::Minitest::Test def test_registers_offense_when_using_refute_calling_respond_to_method assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/refute_same_test.rb b/test/rubocop/cop/minitest/refute_same_test.rb index 326b31f5..48a783e5 100644 --- a/test/rubocop/cop/minitest/refute_same_test.rb +++ b/test/rubocop/cop/minitest/refute_same_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class RefuteSameTest < Minitest::Test +class RefuteSameTest < RuboCop::Minitest::Test def test_registers_offense_when_using_equal assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/return_in_test_case_method_test.rb b/test/rubocop/cop/minitest/return_in_test_case_method_test.rb index 22f7f91d..61e85aad 100644 --- a/test/rubocop/cop/minitest/return_in_test_case_method_test.rb +++ b/test/rubocop/cop/minitest/return_in_test_case_method_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class ReturnInTestMethodTest < Minitest::Test +class ReturnInTestMethodTest < RuboCop::Minitest::Test def test_registers_offense_when_using_return_inside_test_method assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/skip_ensure_test.rb b/test/rubocop/cop/minitest/skip_ensure_test.rb index e80be68d..44c0b02a 100644 --- a/test/rubocop/cop/minitest/skip_ensure_test.rb +++ b/test/rubocop/cop/minitest/skip_ensure_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class SkipEnsureTest < Minitest::Test +class SkipEnsureTest < RuboCop::Minitest::Test def test_registers_offense_when_using_skip_in_the_method_body assert_offense(<<~RUBY) def test_skip diff --git a/test/rubocop/cop/minitest/skip_without_reason_test.rb b/test/rubocop/cop/minitest/skip_without_reason_test.rb index f77cc48c..945c87e1 100644 --- a/test/rubocop/cop/minitest/skip_without_reason_test.rb +++ b/test/rubocop/cop/minitest/skip_without_reason_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class SkipWithoutReasonTest < Minitest::Test +class SkipWithoutReasonTest < RuboCop::Minitest::Test def test_registers_offense_when_skip_without_reason assert_offense(<<~RUBY) skip diff --git a/test/rubocop/cop/minitest/test_file_name_test.rb b/test/rubocop/cop/minitest/test_file_name_test.rb index b38d1b04..b029054d 100644 --- a/test/rubocop/cop/minitest/test_file_name_test.rb +++ b/test/rubocop/cop/minitest/test_file_name_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class TestFileNameTest < Minitest::Test +class TestFileNameTest < RuboCop::Minitest::Test def test_registers_offense_for_invalid_path offenses = inspect_source(<<~RUBY, @cop, 'lib/foo.rb') class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/test_method_name_test.rb b/test/rubocop/cop/minitest/test_method_name_test.rb index e108fd97..1472a2d0 100644 --- a/test/rubocop/cop/minitest/test_method_name_test.rb +++ b/test/rubocop/cop/minitest/test_method_name_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class TestMethodNameTest < Minitest::Test +class TestMethodNameTest < RuboCop::Minitest::Test def test_registers_offense_when_test_method_without_prefix assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/unreachable_assertion_test.rb b/test/rubocop/cop/minitest/unreachable_assertion_test.rb index 3c83ea66..ae8e828b 100644 --- a/test/rubocop/cop/minitest/unreachable_assertion_test.rb +++ b/test/rubocop/cop/minitest/unreachable_assertion_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class UnreachableAssertionTest < Minitest::Test +class UnreachableAssertionTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_equal_at_bottom_of_assert_raises_block assert_offense(<<~RUBY) assert_raises FooError do diff --git a/test/rubocop/cop/minitest/unspecified_exception_test.rb b/test/rubocop/cop/minitest/unspecified_exception_test.rb index 8378451e..29454979 100644 --- a/test/rubocop/cop/minitest/unspecified_exception_test.rb +++ b/test/rubocop/cop/minitest/unspecified_exception_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class UnspecifiedExceptionTest < Minitest::Test +class UnspecifiedExceptionTest < RuboCop::Minitest::Test def test_registers_offense_when_using_assert_raises_without_exception assert_offense(<<~RUBY) class FooTest < Minitest::Test diff --git a/test/rubocop/cop/minitest/useless_assertion_test.rb b/test/rubocop/cop/minitest/useless_assertion_test.rb index 802c3afb..bcd2da11 100644 --- a/test/rubocop/cop/minitest/useless_assertion_test.rb +++ b/test/rubocop/cop/minitest/useless_assertion_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class UselessAssertionTest < Minitest::Test +class UselessAssertionTest < RuboCop::Minitest::Test %i[assert refute assert_nil refute_nil assert_not assert_empty refute_empty].each do |matcher| define_method("test_#{matcher}_registers_offense_when_using_literals") do assert_offense(<<~RUBY, matcher: matcher) diff --git a/test/rubocop/cop/mixin/minitest_exploration_helpers_test.rb b/test/rubocop/cop/mixin/minitest_exploration_helpers_test.rb index c1bea0f9..b359f79c 100644 --- a/test/rubocop/cop/mixin/minitest_exploration_helpers_test.rb +++ b/test/rubocop/cop/mixin/minitest_exploration_helpers_test.rb @@ -2,7 +2,7 @@ require_relative '../../../test_helper' -class MinitestExplorationHelpersTest < Minitest::Test +class MinitestExplorationHelpersTest < RuboCop::Minitest::Test module Helper extend RuboCop::Cop::MinitestExplorationHelpers class << self diff --git a/test/test_helper.rb b/test/test_helper.rb index 349ed7ad..fb85c1db 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -5,6 +5,8 @@ # Require supporting files exposed for testing. require_relative '../lib/rubocop/minitest/support' require 'minitest/proveit' +require 'minitest/pride' +require 'minitest/autorun' Minitest::Test.class_eval do prove_it!