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

Minitest/AssertTruthy should be marked as unsafe for autocorrection #209

Closed
andyw8 opened this issue Dec 27, 2022 · 2 comments · Fixed by #211
Closed

Minitest/AssertTruthy should be marked as unsafe for autocorrection #209

andyw8 opened this issue Dec 27, 2022 · 2 comments · Fixed by #211
Labels
bug Something isn't working

Comments

@andyw8
Copy link
Contributor

andyw8 commented Dec 27, 2022

If the intention is to check for a true/false value rather than truthy or falsey, then the autocorrection could result in a test passing when it shouldn't.

Expected behavior

assert_equal true, item.flagged should not be autocorrected.

Actual behavior

It is auto-corrected to assert item.flagged. So the test would still pass even if flagged returned a string.

RuboCop version

rubocop-minitest (0.25.1)

@koic koic added the bug Something isn't working label Dec 30, 2022
koic added a commit to koic/rubocop-minitest that referenced this issue Dec 30, 2022
Fixes rubocop#209.

This PR marks `Minitest/AssertTruthy` as unsafe autocorrection.
@koic koic closed this as completed in #211 Dec 30, 2022
koic added a commit that referenced this issue Dec 30, 2022
…fe_autocorrection

[Fix #209] Mark `Minitest/AssertTruthy` as unsafe autocorrection
@jana4u
Copy link

jana4u commented Jan 17, 2023

I think Minitest/RefuteFalse should be handled the same (marked as unsafe) to distinguish between nil and false then?

koic added a commit to koic/rubocop-minitest that referenced this issue Jan 21, 2023
This PR marks `Minitest/RefuteFalse` as unsafe autocorrection.
rubocop#209 (comment)
koic added a commit to koic/rubocop-minitest that referenced this issue Jan 21, 2023
Follow up rubocop#209 (comment)

This PR marks `Minitest/RefuteFalse` as unsafe autocorrection.
koic added a commit to koic/rubocop-minitest that referenced this issue Jan 21, 2023
Follow up rubocop#209 (comment)

This PR marks `Minitest/RefuteFalse` as unsafe.
@koic
Copy link
Member

koic commented Jan 21, 2023

@jana4u Good catch! I've opened #233.

koic added a commit to koic/rubocop-minitest that referenced this issue Jan 21, 2023
Follow up rubocop#209 (comment)

This PR marks `Minitest/RefuteFalse` as unsafe.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants