Skip to content

Commit

Permalink
Cut 0.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Mar 13, 2022
1 parent 7520b9a commit 67f9042
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## master (unreleased)

## 0.18.0 (2022-03-13)

### New features

* [#161](https://github.com/rubocop/rubocop-minitest/pull/161): Add new `Minitest/AssertPredicate` and `Minitest/RefutePredicate` cops. ([@koic][])
Expand Down
4 changes: 2 additions & 2 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Minitest/AssertPredicate:
Description: 'This cop enforces the test to use `assert_predicate` instead of using `assert(obj.a_predicate_method?)`.'
StyleGuide: 'https://minitest.rubystyle.guide/#assert-predicate'
Enabled: pending
VersionAdded: '<<next>>'
VersionAdded: '0.18'

Minitest/AssertSilent:
Description: "This cop enforces the test to use `assert_silent { ... }` instead of using `assert_output('', '') { ... }`."
Expand Down Expand Up @@ -204,7 +204,7 @@ Minitest/RefutePredicate:
Description: 'This cop enforces the test to use `refute_predicate` instead of using `refute(obj.a_predicate_method?)`.'
StyleGuide: 'https://minitest.rubystyle.guide/#refute-predicate'
Enabled: pending
VersionAdded: '<<next>>'
VersionAdded: '0.18'

Minitest/RefuteRespondTo:
Description: 'This cop enforces the test to use `refute_respond_to(object, :do_something)` over `refute(object.respond_to?(:do_something))`.'
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: 'master'
version: '0.18'
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 @@ -24,6 +24,7 @@ based on the https://minitest.rubystyle.guide/[Minitest Style Guide].
* xref:cops_minitest.adoc#minitestassertnil[Minitest/AssertNil]
* xref:cops_minitest.adoc#minitestassertoutput[Minitest/AssertOutput]
* xref:cops_minitest.adoc#minitestassertpathexists[Minitest/AssertPathExists]
* xref:cops_minitest.adoc#minitestassertpredicate[Minitest/AssertPredicate]
* xref:cops_minitest.adoc#minitestassertrespondto[Minitest/AssertRespondTo]
* xref:cops_minitest.adoc#minitestassertsilent[Minitest/AssertSilent]
* xref:cops_minitest.adoc#minitestasserttruthy[Minitest/AssertTruthy]
Expand All @@ -43,6 +44,7 @@ based on the https://minitest.rubystyle.guide/[Minitest Style Guide].
* xref:cops_minitest.adoc#minitestrefutematch[Minitest/RefuteMatch]
* xref:cops_minitest.adoc#minitestrefutenil[Minitest/RefuteNil]
* xref:cops_minitest.adoc#minitestrefutepathexists[Minitest/RefutePathExists]
* xref:cops_minitest.adoc#minitestrefutepredicate[Minitest/RefutePredicate]
* xref:cops_minitest.adoc#minitestrefuterespondto[Minitest/RefuteRespondTo]
* xref:cops_minitest.adoc#minitesttestmethodname[Minitest/TestMethodName]
* xref:cops_minitest.adoc#minitestunreachableassertion[Minitest/UnreachableAssertion]
Expand Down
72 changes: 70 additions & 2 deletions docs/modules/ROOT/pages/cops_minitest.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ assert_match(matcher, string, 'message')
|===

This cop enforces the test to use `assert_nil` instead of using
`assert_equal(nil, something)` or `assert(something.nil?)`.
`assert_equal(nil, something)`, `assert(something.nil?)`, or `assert_predicate(something, :nil?)`.

=== Examples

Expand All @@ -273,6 +273,8 @@ assert_equal(nil, actual)
assert_equal(nil, actual, 'message')
assert(object.nil?)
assert(object.nil?, 'message')
assert_predicate(object, :nil?)
assert_predicate(object, :nil?, 'message')
# good
assert_nil(actual)
Expand Down Expand Up @@ -347,6 +349,38 @@ assert_path_exists(path, 'message')

* https://minitest.rubystyle.guide/#assert-path-exists

== Minitest/AssertPredicate

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

| Pending
| Yes
| Yes
| 0.18
| -
|===

This cop enforces the test to use `assert_predicate`
instead of using `assert(obj.a_predicate_method?)`.

=== Examples

[source,ruby]
----
# bad
assert(obj.one?)
assert(obj.one?, 'message')
# good
assert_predicate(obj, :one?)
assert_predicate(obj, :one?, 'message')
----

=== References

* https://minitest.rubystyle.guide/#assert-predicate

== Minitest/AssertRespondTo

|===
Expand Down Expand Up @@ -1025,7 +1059,7 @@ refute_match(matcher, string, 'message')
|===

This cop enforces the test to use `refute_nil` instead of using
`refute_equal(nil, something)` or `refute(something.nil?)`.
`refute_equal(nil, something)`, `refute(something.nil?)`, or `refute_predicate(something, :nil?)`.

=== Examples

Expand All @@ -1036,6 +1070,8 @@ refute_equal(nil, actual)
refute_equal(nil, actual, 'message')
refute(actual.nil?)
refute(actual.nil?, 'message')
refute_predicate(object, :nil?)
refute_predicate(object, :nil?, 'message')
# good
refute_nil(actual)
Expand Down Expand Up @@ -1078,6 +1114,38 @@ refute_path_exists(path, 'message')

* https://minitest.rubystyle.guide/#refute-path-exists

== Minitest/RefutePredicate

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

| Pending
| Yes
| Yes
| 0.18
| -
|===

This cop enforces the test to use `refute_predicate`
instead of using `refute(obj.a_predicate_method?)`.

=== Examples

[source,ruby]
----
# bad
refute(obj.one?)
refute(obj.one?, 'message')
# good
refute_predicate(obj, :one?)
refute_predicate(obj, :one?, 'message')
----

=== References

* https://minitest.rubystyle.guide/#refute-predicate

== Minitest/RefuteRespondTo

|===
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.17.2'
STRING = '0.18.0'

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

* [#161](https://github.com/rubocop/rubocop-minitest/pull/161): Add new `Minitest/AssertPredicate` and `Minitest/RefutePredicate` cops. ([@koic][])

### Changes

* [#162](https://github.com/rubocop/rubocop-minitest/pull/162): Make `Minitest/AssertNil` (`Minitest/RefuteNil`) aware of `assert_predicate(obj, :nil?)` (`refute_predicate(obj, :nil?)`). ([@koic][])

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

0 comments on commit 67f9042

Please sign in to comment.