From d368a64771fbcbbe5a81fcdfe54ddef4fe6ae116 Mon Sep 17 00:00:00 2001 From: Jason Garber Date: Mon, 6 May 2024 11:47:37 -0400 Subject: [PATCH 1/2] Configure `Capybara/ClickLinkOrButtonStyle` 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] https://github.com/rubocop/rubocop-capybara/pull/61 [3] https://github.com/rubocop/rubocop-capybara/pull/61#issuecomment-1889733809 [4] https://github.com/rubocop/rubocop-capybara/issues/81 [5] https://github.com/rubocop/rubocop-capybara/pull/99 --- config/rubocop-capybara.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/rubocop-capybara.yml b/config/rubocop-capybara.yml index c559f5a..18fa2cc 100644 --- a/config/rubocop-capybara.yml +++ b/config/rubocop-capybara.yml @@ -6,3 +6,6 @@ # @see https://github.com/rubocop/rubocop-capybara require: rubocop-capybara + +Capybara/ClickLinkOrButtonStyle: + EnforcedStyle: strict From ede13c8bb2fbb353994fbcc3fe4b795b0376b2a7 Mon Sep 17 00:00:00 2001 From: Jason Garber Date: Mon, 6 May 2024 12:02:18 -0400 Subject: [PATCH 2/2] Bump version to v1.1.0 --- Gemfile.lock | 2 +- rubocop-cargosense.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7829805..b03a50c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rubocop-cargosense (1.0.0) + rubocop-cargosense (1.1.0) rubocop (~> 1.59) rubocop-capybara (~> 2.20) rubocop-factory_bot (~> 2.25) diff --git a/rubocop-cargosense.gemspec b/rubocop-cargosense.gemspec index 764efad..2b8a0c6 100644 --- a/rubocop-cargosense.gemspec +++ b/rubocop-cargosense.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ">= 3.0" spec.name = "rubocop-cargosense" - spec.version = "1.0.0" + spec.version = "1.1.0" spec.authors = ["CargoSense"] spec.email = ["rubygems@cargosense.com"]