-
-
Notifications
You must be signed in to change notification settings - Fork 277
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
Add support for assert_true
and assert_false
to RSpec/Rails/MinitestAssertions
#1786
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good.
I agree with @koic that we should auto-correct to stricter be(true)/be(false).
bdd524b
to
2ba998b
Compare
Ah I missed some comments. Hmm. I think we should distinguish between Minitest and Test:: Unit. |
fwiw I currently vote for "have a single cop" because these all seem to be using the same structure and as a downstream user my focus is on "use Put another way: I don't think I've yet seen a technical reason for having different cops? i.e. the assertions so far have followed the same logic and structure regardless of where they're actually from. If people want to rename it to something like |
@G-Rath Thank you for expressing your opinion.
In many cases, I think there is no problem to combine them into one cop. However, as the devil's advocate, I would like to deepen this discussion. For example, the following comments seem to be points where different actions are required. The compatibility of Also, the adapter to Minitest is defined in rspec-rails, which is appropriate for the RSpec/Rails department. Note, however, that Unit:: Test exists in rspec-core. In other words, it seems odd to enable Cop for the RSpec/Rails department if you are using Unit:: Test-style assertions and not rspec-rails. |
Yup fully in support of that, and in doing so sooner rather than later.
Just want to check that I'm understanding what you mean correctly, which is effectively: it's weird for someone who's using just Unit::Test but not Rails, to enable a Rails cop. If so then yes I agree with that - I'd wondered why this was considered a Rails cop though you've pointed out it's |
Fair enough, but in the future when we extract rubocop-rspec_rails, we could also extract Rails-specific assertion detectors from this cop, and make the cop open for extension. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Probably best to take this to the issue, but there's also Capybara assertions we could be translating, and I'd like to also include |
Oh, I see. If we needs to extract to rubocop-rspec_rails, maybe we shouldn't add support for this to the RSpec/Rails department's Cop for now? |
I think this all barely exists outside of rspec-rails. Despite the It’s ok to add all this, and all of this actually, not just the AS aliases should later be extracted to rubocop-rspec_rails. |
93bde32
to
354d8a7
Compare
I update this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
354d8a7
to
2d7c792
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
related to rubocop/rubocop-rspec_rails#7
This PR add support for
assert_true
andassert_false
toRSpec/Rails/MinitestAssertions
.Before submitting the PR make sure the following are checked:
master
(if not - rebase it).CHANGELOG.md
if the new code introduces user-observable changes.bundle exec rake
) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).