Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Minitest/AssertInstanceOf and Minitest/RefuteInstanceOf aware of assert_equal and refute_equal #248

Merged
merged 1 commit into from
Mar 31, 2023

Conversation

koic
Copy link
Member

@koic koic commented Mar 28, 2023

This PR makes Minitest/AssertInstanceOf and Minitest/RefuteInstanceOf aware of assert_equal(Class, object.class) and refute_equal(Class, object.class).


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

@koic koic force-pushed the make_instance_of_cops_aware_of_equal branch from acc47ea to 840b1c2 Compare March 28, 2023 05:26
@koic koic mentioned this pull request Mar 28, 2023
7 tasks
@koic koic force-pushed the make_instance_of_cops_aware_of_equal branch from 840b1c2 to f8202b3 Compare March 28, 2023 05:28
assert_offense(<<~RUBY)
class FooTest < Minitest::Test
def test_do_something
refute((object.instance_of?(SomeClass)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `refute_instance_of(SomeClass, object)`.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: Redundant parentheses will be resolved in rubocop/rubocop#11739, so removed from this cop role.

@koic koic force-pushed the make_instance_of_cops_aware_of_equal branch 3 times, most recently from 3af2fbd to 158f2e9 Compare March 28, 2023 15:48
…e of `assert_equal` and `refute_equal`

This PR makes `Minitest/AssertInstanceOf` and `Minitest/RefuteInstanceOf` aware of
`assert_equal(Class, object.class)` and `refute_equal(Class, object.class)`.
@koic koic force-pushed the make_instance_of_cops_aware_of_equal branch from 158f2e9 to 2d9e7ca Compare March 28, 2023 16:59
@koic koic merged commit fe0618e into rubocop:master Mar 31, 2023
@koic koic deleted the make_instance_of_cops_aware_of_equal branch March 31, 2023 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant