Skip to content

Commit

Permalink
Merge pull request #127 from koic/mark_assert_with_expected_argument_…
Browse files Browse the repository at this point in the history
…as_unsafe

[Fix #126] Mark `Minitest/AssertWithExpectedArgument` as unsafe
  • Loading branch information
koic authored Mar 30, 2021
2 parents 0d47b7e + c428f3d commit e730e3e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## master (unreleased)

### Changes

* [#126](https://github.com/rubocop/rubocop-minitest/issues/126): Mark `Minitest/AssertWithExpectedArgument` as unsafe. ([@koic][])

## 0.11.0 (2021-03-22)

### New features
Expand Down
1 change: 1 addition & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Minitest/AssertTruthy:
Minitest/AssertWithExpectedArgument:
Description: 'This cop tries to detect when a user accidentally used `assert` when they meant to use `assert_equal`.'
Enabled: pending
Safe: false
VersionAdded: '0.11'

Minitest/GlobalExpectations:
Expand Down
5 changes: 4 additions & 1 deletion docs/modules/ROOT/pages/cops_minitest.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ assert(actual, 'message')
| Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged

| Pending
| Yes
| No
| No
| 0.11
| -
Expand All @@ -456,6 +456,9 @@ assert(actual, 'message')
This cop tries to detect when a user accidentally used
`assert` when they meant to use `assert_equal`.

It is marked as unsafe because it is not possible to determine
whether the second argument of `assert` is a message or not.

=== Examples

[source,ruby]
Expand Down
3 changes: 3 additions & 0 deletions lib/rubocop/cop/minitest/assert_with_expected_argument.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ module Minitest
# This cop tries to detect when a user accidentally used
# `assert` when they meant to use `assert_equal`.
#
# It is marked as unsafe because it is not possible to determine
# whether the second argument of `assert` is a message or not.
#
# @example
# # bad
# assert(3, my_list.length)
Expand Down

0 comments on commit e730e3e

Please sign in to comment.