Skip to content

Commit

Permalink
Cut 0.34.0
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Dec 16, 2023
1 parent 0b2911f commit 33e2db5
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

## master (unreleased)

## 0.34.0 (2023-12-16)

### New features

* [#272](https://github.com/rubocop/rubocop-minitest/pull/272): Add new Minitest/RedundantMessageArgument cop. ([@koic][])
Expand Down
4 changes: 2 additions & 2 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Minitest/NonExecutableTestMethod:
Description: 'Checks uses of test methods outside test class.'
Enabled: pending
Severity: warning
VersionAdded: '<<next>>'
VersionAdded: '0.34'

Minitest/NonPublicTestMethod:
Description: 'Detects non `public` (marked as `private` or `protected`) test methods.'
Expand All @@ -207,7 +207,7 @@ Minitest/NonPublicTestMethod:
Minitest/RedundantMessageArgument:
Description: 'Detects redundant message argument in assertion methods.'
Enabled: pending
VersionAdded: '<<next>>'
VersionAdded: '0.34'

Minitest/RefuteEmpty:
Description: 'This cop enforces to use `refute_empty` instead of using `refute(object.empty?)`.'
Expand Down
2 changes: 1 addition & 1 deletion docs/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ~
version: '0.34'
nav:
- modules/ROOT/nav.adoc
2 changes: 2 additions & 0 deletions docs/modules/ROOT/pages/cops.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ based on the https://minitest.rubystyle.guide/[Minitest Style Guide].
* xref:cops_minitest.adoc#minitestmultipleassertions[Minitest/MultipleAssertions]
* xref:cops_minitest.adoc#minitestnoassertions[Minitest/NoAssertions]
* xref:cops_minitest.adoc#minitestnotestcases[Minitest/NoTestCases]
* xref:cops_minitest.adoc#minitestnonexecutabletestmethod[Minitest/NonExecutableTestMethod]
* xref:cops_minitest.adoc#minitestnonpublictestmethod[Minitest/NonPublicTestMethod]
* xref:cops_minitest.adoc#minitestredundantmessageargument[Minitest/RedundantMessageArgument]
* xref:cops_minitest.adoc#minitestrefuteempty[Minitest/RefuteEmpty]
* xref:cops_minitest.adoc#minitestrefuteequal[Minitest/RefuteEqual]
* xref:cops_minitest.adoc#minitestrefutefalse[Minitest/RefuteFalse]
Expand Down
75 changes: 75 additions & 0 deletions docs/modules/ROOT/pages/cops_minitest.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ NOTE: Use `assert_same` only when there is a need to compare by identity.
----
# bad
assert(expected.equal?(actual))
assert_equal(expected.object_id, actual.object_id)
# good
assert_same(expected, actual)
Expand Down Expand Up @@ -1150,6 +1151,52 @@ class FooTest < Minitest::Test
end
----

== Minitest/NonExecutableTestMethod

|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Pending
| Yes
| No
| 0.34
| -
|===

Checks for the use of test methods outside of a test class.

Test methods should be defined within a test class to ensure their execution.

NOTE: This cop assumes that classes whose superclass name includes the word
"`Test`" are test classes, in order to prevent false positives.

=== Examples

[source,ruby]
----
# bad
class FooTest < Minitest::Test
end
def test_method_should_be_inside_test_class
end
# good
class FooTest < Minitest::Test
def test_method_should_be_inside_test_class
end
end
----

=== Configurable attributes

|===
| Name | Default value | Configurable values

| Severity
| `warning`
| String
|===

== Minitest/NonPublicTestMethod

|===
Expand Down Expand Up @@ -1211,6 +1258,33 @@ end
| String
|===

== Minitest/RedundantMessageArgument

|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Pending
| Yes
| Yes
| 0.34
| -
|===

Detects redundant message argument in assertion methods.
The message argument `nil` is redundant because it is the default value.

=== Examples

[source,ruby]
----
# bad
assert_equal(expected, actual, nil)
# good
assert_equal(expected, actual)
assert_equal(expected, actual, 'message')
----

== Minitest/RefuteEmpty

|===
Expand Down Expand Up @@ -1674,6 +1748,7 @@ NOTE: Use `refute_same` only when there is a need to compare by identity.
----
# bad
refute(expected.equal?(actual))
refute_equal(expected.object_id, actual.object_id)
# good
refute_same(expected, actual)
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/minitest/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module RuboCop
module Minitest
# This module holds the RuboCop Minitest version information.
module Version
STRING = '0.33.0'
STRING = '0.34.0'

def self.document_version
STRING.match('\d+\.\d+').to_s
Expand Down
18 changes: 18 additions & 0 deletions relnotes/v0.34.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
### New features

* [#272](https://github.com/rubocop/rubocop-minitest/pull/272): Add new Minitest/RedundantMessageArgument cop. ([@koic][])

### Bug fixes

* [#275](https://github.com/rubocop/rubocop-minitest/pull/275): Make `Minitest/AssertMatch` aware of `assert_operator` when running with Ruby 2.7. ([@koic][])
* [#271](https://github.com/rubocop/rubocop-minitest/issues/271): Fix a false positive for `Minitest/EmptyLineBeforeAssertionMethods` and `assert_raises`. ([@fatkodima][])

### Changes

* [#270](https://github.com/rubocop/rubocop-minitest/pull/270): Ignore offenses inside redundant parentheses. ([@sambostock][])
* [#274](https://github.com/rubocop/rubocop-minitest/pull/274): Require RuboCop AST 1.30.0+. ([@koic][])
* [#276](https://github.com/rubocop/rubocop-minitest/pull/276): Enhance `AssertSame`/`RefuteSame` to check for `object_id` comparison. ([@fatkodima][])

[@koic]: https://github.com/koic
[@fatkodima]: https://github.com/fatkodima
[@sambostock]: https://github.com/sambostock

0 comments on commit 33e2db5

Please sign in to comment.