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

Capybara/ClickLinkOrButtonStyle: Enforce strict style #32

Merged
merged 2 commits into from
May 6, 2024

Conversation

jgarber623
Copy link

@jgarber623 jgarber623 commented May 6, 2024

Description

This rule's default enforce style, link_or_button [1], introduced a number of problems [2]. Specifically, I noticed issues switching to click_on from click_button [3]. The hack solution is to ignore or disable the rule in some places but not in others. Not great.

As a result, the rule is slated for removal [4] and replacement [5] by a new rule. In the interim, configuring this rule to enforce a strict use of click_button and click_link is preferential (and, honestly, more communicative).

In this author's opinion, user interface specs should be explicit about the markup under test.

[1] https://docs.rubocop.org/rubocop-capybara/cops_capybara.html#capybaraclicklinkorbuttonstyle
[2] rubocop/rubocop-capybara#61
[3] rubocop/rubocop-capybara#61 (comment)
[4] rubocop/rubocop-capybara#81
[5] rubocop/rubocop-capybara#99

Commits

  • Configure Capybara/ClickLinkOrButtonStyle
  • Bump version to v1.1.0

This rule's default enforce style, `link_or_button` [1], introduced a
number of problems [2]. Specifically, I noticed issues switching to
`click_on` from `click_button` [3]. The hack solution is to ignore or
disable the rule in some places but not in others. Not great.

As a result, the rule is slated for removal [4] and replacement [5] by
a new rule. In the interim, configuring this rule to enforce a strict
use of `click_button` and `click_link` is preferential (and, honestly,
more communicative).

In this author's opinion, user interface specs should be explicit about
the markup under test.

[1] https://docs.rubocop.org/rubocop-capybara/cops_capybara.html#capybaraclicklinkorbuttonstyle
[2] rubocop/rubocop-capybara#61
[3] rubocop/rubocop-capybara#61 (comment)
[4] rubocop/rubocop-capybara#81
[5] rubocop/rubocop-capybara#99
@jgarber623 jgarber623 requested a review from a team as a code owner May 6, 2024 16:03
@jgarber623 jgarber623 self-assigned this May 6, 2024
@jgarber623 jgarber623 merged commit 80f2f42 into main May 6, 2024
8 checks passed
@jgarber623 jgarber623 deleted the capybara-click-link-or-button-style-enforce-strict branch May 6, 2024 16:08
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.

2 participants