From 50e790f2b5b3f5b2e06db0695e2e1f92dfcfa9bf Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sun, 3 Oct 2021 04:51:38 +0900 Subject: [PATCH] Mark `Minitest/AssertEmptyLiteral` as safe auto-correction This PR marks `Minitest/AssertEmptyLiteral` as safe auto-correction. Introduced as unsafe auto-correction in #85, but now safe auto-correction with changes in #118. --- CHANGELOG.md | 4 ++++ config/default.yml | 3 +-- docs/modules/ROOT/pages/cops_minitest.adoc | 4 ++-- lib/rubocop/cop/minitest/assert_empty_literal.rb | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4efa78de..02128b01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## master (unreleased) +### Bug fixes + +* [#144](https://github.com/rubocop/rubocop-minitest/pull/144): Mark `Minitest/AssertEmptyLiteral` as safe auto-correction. ([@koic][]) + ## 0.15.1 (2021-09-26) ### Bug fixes diff --git a/config/default.yml b/config/default.yml index 1c098d55..59239bcc 100644 --- a/config/default.yml +++ b/config/default.yml @@ -11,9 +11,8 @@ Minitest/AssertEmpty: VersionAdded: '0.2' Minitest/AssertEmptyLiteral: - Description: 'This cop enforces the test to use `assert_empty` instead of using `assert([], object)` or `assert({}, object)`.' + Description: 'This cop enforces the test to use `assert_empty` instead of using `assert_equal([], object)`.' Enabled: true - SafeAutoCorrect: false VersionAdded: '0.5' VersionChanged: '0.11' diff --git a/docs/modules/ROOT/pages/cops_minitest.adoc b/docs/modules/ROOT/pages/cops_minitest.adoc index 707f2e5e..4fd66537 100644 --- a/docs/modules/ROOT/pages/cops_minitest.adoc +++ b/docs/modules/ROOT/pages/cops_minitest.adoc @@ -39,13 +39,13 @@ assert_empty(object, 'message') | Enabled | Yes -| Yes (Unsafe) +| Yes | 0.5 | 0.11 |=== This cop enforces the test to use `assert_empty` -instead of using `assert_equal([], object)`. +instead of using `assert_equal([], object)` or `assert_equal({}, object)`. === Examples diff --git a/lib/rubocop/cop/minitest/assert_empty_literal.rb b/lib/rubocop/cop/minitest/assert_empty_literal.rb index 84f6616c..10d3ebc0 100644 --- a/lib/rubocop/cop/minitest/assert_empty_literal.rb +++ b/lib/rubocop/cop/minitest/assert_empty_literal.rb @@ -4,7 +4,7 @@ module RuboCop module Cop module Minitest # This cop enforces the test to use `assert_empty` - # instead of using `assert_equal([], object)`. + # instead of using `assert_equal([], object)` or `assert_equal({}, object)`. # # @example # # bad