-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Capybara/SpecificFinders
conflicts with Rails/DynamicFindBy
#23
Comments
Hi, thanks for your feedback! I also recognize the issue. FYI, rubocop-rails provides a measure to mitigate false positives for this capybara-derived method.
How about doing the following to avoid this? Rails/DynamicFindBy:
AllowedMethods:
- find_by_sql # default by rubocop-rails
- find_by_token_for # default by rubocop-rails
- find_by_id |
I don't entirely understand, can you please provide an example of an offence raised by DynamicFinders? |
@ydah Thanks for your suggestion. I've seen this somewhere, but I don't really want to whitelist those methods for |
@pirj I have this code: expect(page.find("#id")).to be_checked
expect(page.find_by_id('id')).to be_checked which is flagged by
|
@FunnyHector Ah. I overlooked one thing, but if you keep rubocop-rails up-to-date, I don't think that problem will occur. |
@ydah ah ye my rubocop-rails isn't very up to date. #862 should resolve this issue. Thanks to everyone for this! We can close this issue now I believe. |
Sorry for the hi-jack but I have a quick question. Having just started using rubocop-capybara I was presented with this error. The exact error message is: But if the only option is to use |
Thank you for your feedback! We will open the next Pull Request to improve the message. |
Capybara/SpecificFinders
suggests the following change:However,
find_by_id
is going to be flagged byRails/DynamicFindBy
.These two cops can't be enabled together. If I had to choose from the two,
Rails/DynamicFindBy
would be my choice andCapybara/SpecificFinders
would be disabled.Expected behavior
Capybara/SpecificFinders
could somehow respectRails/DynamicFindBy
.Actual behavior
They have conflicting opinions on code like these.
RuboCop version
The text was updated successfully, but these errors were encountered: