From 398f65402086f864dc107b56b5387eaedc58cf33 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Tue, 5 Apr 2022 12:37:34 +0900 Subject: [PATCH] Cut 0.19.0 --- CHANGELOG.md | 2 + config/default.yml | 2 +- docs/antora.yml | 2 +- docs/modules/ROOT/pages/cops.adoc | 1 + docs/modules/ROOT/pages/cops_minitest.adoc | 57 ++++++++++++++++++++++ lib/rubocop/minitest/version.rb | 2 +- relnotes/v0.19.0.md | 5 ++ 7 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 relnotes/v0.19.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index d2225646..d9db932a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master (unreleased) +## 0.19.0 (2022-04-05) + ### New features * [#164](https://github.com/rubocop/rubocop-minitest/pull/164): Add new `Minitest/DuplicateTestRun cop. ([@ignacio-chiazzo][]) diff --git a/config/default.yml b/config/default.yml index b42e2f61..302f652c 100644 --- a/config/default.yml +++ b/config/default.yml @@ -108,7 +108,7 @@ Minitest/AssertionInLifecycleHook: Minitest/DuplicateTestRun: Description: 'This cop detects duplicate test runs caused by one test class inheriting from another.' Enabled: pending - VersionAdded: '<>' + VersionAdded: '0.19' Minitest/GlobalExpectations: Description: 'This cop checks for deprecated global expectations.' diff --git a/docs/antora.yml b/docs/antora.yml index 5fb5d9b0..ada8f2b0 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -2,6 +2,6 @@ name: rubocop-minitest title: RuboCop Minitest # We always provide version without patch here (e.g. 1.1), # as patch versions should not appear in the docs. -version: 'master' +version: '0.19' nav: - modules/ROOT/nav.adoc diff --git a/docs/modules/ROOT/pages/cops.adoc b/docs/modules/ROOT/pages/cops.adoc index 979f17dc..cae46101 100644 --- a/docs/modules/ROOT/pages/cops.adoc +++ b/docs/modules/ROOT/pages/cops.adoc @@ -30,6 +30,7 @@ based on the https://minitest.rubystyle.guide/[Minitest Style Guide]. * xref:cops_minitest.adoc#minitestasserttruthy[Minitest/AssertTruthy] * xref:cops_minitest.adoc#minitestassertwithexpectedargument[Minitest/AssertWithExpectedArgument] * xref:cops_minitest.adoc#minitestassertioninlifecyclehook[Minitest/AssertionInLifecycleHook] +* xref:cops_minitest.adoc#minitestduplicatetestrun[Minitest/DuplicateTestRun] * xref:cops_minitest.adoc#minitestglobalexpectations[Minitest/GlobalExpectations] * xref:cops_minitest.adoc#minitestliteralasactualargument[Minitest/LiteralAsActualArgument] * xref:cops_minitest.adoc#minitestmultipleassertions[Minitest/MultipleAssertions] diff --git a/docs/modules/ROOT/pages/cops_minitest.adoc b/docs/modules/ROOT/pages/cops_minitest.adoc index b323fff5..4d12242c 100644 --- a/docs/modules/ROOT/pages/cops_minitest.adoc +++ b/docs/modules/ROOT/pages/cops_minitest.adoc @@ -544,6 +544,63 @@ class FooTest < Minitest::Test end ---- +== Minitest/DuplicateTestRun + +|=== +| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed + +| Pending +| Yes +| No +| 0.19 +| - +|=== + +If a Minitest class inherits from another class, +it will also inherit its methods causing Minitest to run the parent's tests methods twice. + +This cop detects when there are two tests classes, one inherits from the other, and both have tests methods. +This cop will add an offence to the Child class in such a case. + +=== Examples + +[source,ruby] +---- +# bad +class ParentTest < Minitest::Test + def test_parent # it will run this test twice. + end +end + +class ChildTest < ParentTest + def test_child + end +end + +# good +class ParentTest < Minitest::Test + def test_parent + end +end + +class ChildTest < Minitest::Test + def test_child + end +end + +# good +class ParentTest < Minitest::Test +end + +class ChildTest + def test_child + end + + def test_parent + end +end +---- + == Minitest/GlobalExpectations |=== diff --git a/lib/rubocop/minitest/version.rb b/lib/rubocop/minitest/version.rb index 428b99e3..f0613ffe 100644 --- a/lib/rubocop/minitest/version.rb +++ b/lib/rubocop/minitest/version.rb @@ -4,7 +4,7 @@ module RuboCop module Minitest # This module holds the RuboCop Minitest version information. module Version - STRING = '0.18.0' + STRING = '0.19.0' def self.document_version STRING.match('\d+\.\d+').to_s diff --git a/relnotes/v0.19.0.md b/relnotes/v0.19.0.md new file mode 100644 index 00000000..39ccbe14 --- /dev/null +++ b/relnotes/v0.19.0.md @@ -0,0 +1,5 @@ +### New features + +* [#164](https://github.com/rubocop/rubocop-minitest/pull/164): Add new `Minitest/DuplicateTestRun cop. ([@ignacio-chiazzo][]) + +[@ignacio-chiazzo]: https://github.com/ignacio-chiazzo