From 676b63f2783e3f4d01b3343dbf6050386079c644 Mon Sep 17 00:00:00 2001 From: Daniel Lewis Date: Tue, 2 Apr 2024 09:42:00 +0100 Subject: [PATCH 1/3] release 0.12.0 --- .rubocop.yml | 3 --- CHANGELOG.md | 2 +- Gemfile | 3 +-- Gemfile.lock | 27 +++++++++++++++------------ 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index b69d1b4..1b15fda 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,9 +2,6 @@ inherit_gem: citizens-advice-style: - default.yml -require: - - rubocop-performance - AllCops: SuggestExtensions: false TargetRubyVersion: 3.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index ceacf93..ac05103 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change log -## Unreleased +## v0.12.0 ### Added diff --git a/Gemfile b/Gemfile index 1744f0d..df51f40 100644 --- a/Gemfile +++ b/Gemfile @@ -3,13 +3,12 @@ source "https://rubygems.org" group :test, :development do - gem "citizens-advice-style", git: "https://github.com/citizensadvice/citizens-advice-style-ruby", tag: "v10.0.1" + gem "citizens-advice-style", git: "https://github.com/citizensadvice/citizens-advice-style-ruby", tag: "v11.0.0" gem "debug" gem "puma" gem "rack-test" gem "rackup" gem "rspec" - gem "rubocop-performance" gem "selenium-webdriver" gem "sinatra" end diff --git a/Gemfile.lock b/Gemfile.lock index 8296c04..017a6e0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,13 @@ GIT remote: https://github.com/citizensadvice/citizens-advice-style-ruby - revision: ca09fc508ee68c238428d4558701a766f1e12c79 - tag: v10.0.1 + revision: 6762c3c2185d457e090147ce04facaa5a3e71249 + tag: v11.0.0 specs: - citizens-advice-style (10.0.1) - rubocop (~> 1.45) - rubocop-rails (~> 2.17) - rubocop-rspec (~> 2.18) + citizens-advice-style (11.0.0) + rubocop (~> 1.62) + rubocop-performance (~> 1.20) + rubocop-rails (~> 2.24) + rubocop-rspec (~> 2.27) PATH remote: . @@ -43,7 +44,7 @@ GEM xpath (~> 3.2) concurrent-ruby (1.2.3) connection_pool (2.4.1) - debug (1.9.1) + debug (1.9.2) irb (~> 1.10) reline (>= 0.3.8) diff-lcs (1.5.1) @@ -127,22 +128,25 @@ GEM rubocop (~> 1.41) rubocop-factory_bot (2.25.1) rubocop (~> 1.41) - rubocop-performance (1.20.2) + rubocop-performance (1.21.0) rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.30.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) rubocop-rails (2.24.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rspec (2.27.1) + rubocop-rspec (2.28.0) rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) + rubocop-rspec_rails (~> 2.28) + rubocop-rspec_rails (2.28.2) + rubocop (~> 1.40) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) rubyzip (2.3.2) - selenium-webdriver (4.18.1) + selenium-webdriver (4.19.0) base64 (~> 0.2) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) @@ -175,7 +179,6 @@ DEPENDENCIES rack-test rackup rspec - rubocop-performance selenium-webdriver sinatra From 053ccc25dd72180dabd7381a687488e0a647e2eb Mon Sep 17 00:00:00 2001 From: Daniel Lewis Date: Tue, 2 Apr 2024 11:34:57 +0100 Subject: [PATCH 2/3] remove ruby 3.0 support --- .github/workflows/test_and_lint.yml | 2 +- .rubocop.yml | 2 +- CHANGELOG.md | 4 ++++ capybara_accessible_selectors.gemspec | 2 +- .../rspec/matchers/have_validation_errors.rb | 6 +++--- lib/capybara_accessible_selectors/selectors/grid.rb | 2 +- lib/capybara_accessible_selectors/selectors/img.rb | 2 +- lib/capybara_accessible_selectors/selectors/rich_text.rb | 2 +- spec/selectors/heading_spec.rb | 6 +++--- spec/spec_helper.rb | 6 +++--- 10 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test_and_lint.yml b/.github/workflows/test_and_lint.yml index 020000e..ab14cc7 100644 --- a/.github/workflows/test_and_lint.yml +++ b/.github/workflows/test_and_lint.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - ruby-version: ['3.3', '3.2', '3.1', '3.0'] + ruby-version: ['3.3', '3.2', '3.1'] steps: - uses: actions/checkout@v2 diff --git a/.rubocop.yml b/.rubocop.yml index 1b15fda..03ad377 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,7 +4,7 @@ inherit_gem: AllCops: SuggestExtensions: false - TargetRubyVersion: 3.0 + TargetRubyVersion: 3.1 Capybara/ClickLinkOrButtonStyle: Enabled: false diff --git a/CHANGELOG.md b/CHANGELOG.md index ac05103..22c199c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ - `select_combo_box_option` takes a block which can be used to filter the found options - Added the `aria` filter to all selectors that didn't have it +### Removed + +- Removed support for Ruby 3.0. Minimum supported Ruby version is now 3.1 + ## v0.11.0 ### Added diff --git a/capybara_accessible_selectors.gemspec b/capybara_accessible_selectors.gemspec index 6850f54..44fb873 100644 --- a/capybara_accessible_selectors.gemspec +++ b/capybara_accessible_selectors.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |s| s.files = Dir["lib/**/*.rb"] s.authors = ["Daniel Lewis", "Sean Doyle"] s.license = "ISC" - s.required_ruby_version = ">= 3.0.0" + s.required_ruby_version = ">= 3.1" s.add_runtime_dependency "capybara", "~> 3.36" diff --git a/lib/capybara_accessible_selectors/rspec/matchers/have_validation_errors.rb b/lib/capybara_accessible_selectors/rspec/matchers/have_validation_errors.rb index d4c7bf8..1510c5c 100644 --- a/lib/capybara_accessible_selectors/rspec/matchers/have_validation_errors.rb +++ b/lib/capybara_accessible_selectors/rspec/matchers/have_validation_errors.rb @@ -4,10 +4,10 @@ module Capybara module RSpecMatchers module Matchers class HaveValidationErrors - def matches?(element, &block) + def matches?(element, &) @page = element @elements = [] - instance_eval(&block) + instance_eval(&) @errors = [] all_invalid_elements.reject { |el| @elements.include? el }.each do |el| @@ -43,7 +43,7 @@ def all_invalid_elements end def radio_group(name, exact: nil, **options) - @page.within(:fieldset, name, exact: exact) do + @page.within(:fieldset, name, exact:) do @elements.push(*@page.all(:radio_button, **options)) end end diff --git a/lib/capybara_accessible_selectors/selectors/grid.rb b/lib/capybara_accessible_selectors/selectors/grid.rb index 80a5937..192fbd8 100644 --- a/lib/capybara_accessible_selectors/selectors/grid.rb +++ b/lib/capybara_accessible_selectors/selectors/grid.rb @@ -89,7 +89,7 @@ colindex = node[:"aria-colindex"] || node.ancestor(:row).all(:gridcell).index(node) grid = node.find(:xpath, XPath.ancestor[XPath.attr(:role) == "grid"]) - grid.has_selector?(:columnheader, value, colindex: colindex) + grid.has_selector?(:columnheader, value, colindex:) end filter_set(:capybara_accessible_selectors, %i[aria described_by]) diff --git a/lib/capybara_accessible_selectors/selectors/img.rb b/lib/capybara_accessible_selectors/selectors/img.rb index a117b1b..f47534c 100644 --- a/lib/capybara_accessible_selectors/selectors/img.rb +++ b/lib/capybara_accessible_selectors/selectors/img.rb @@ -2,7 +2,7 @@ Capybara.add_selector(:img, locator_type: [String, Symbol]) do expression_filter(:src, valid_values: [String, Regexp]) do |xpath, src| - builder(xpath).add_attribute_conditions(src: src) + builder(xpath).add_attribute_conditions(src:) end describe(:expression_filters) do |src: nil, **| diff --git a/lib/capybara_accessible_selectors/selectors/rich_text.rb b/lib/capybara_accessible_selectors/selectors/rich_text.rb index 14ab34d..0b7c63b 100644 --- a/lib/capybara_accessible_selectors/selectors/rich_text.rb +++ b/lib/capybara_accessible_selectors/selectors/rich_text.rb @@ -60,7 +60,7 @@ def within_rich_text(locator = nil, **find_options, &block) Capybara.page.within_rich_text(locator, **find_options, &block) end end - within_iframe_rich_text(locator, **find_options, &block) + within_iframe_rich_text(locator, **find_options, &block) # rubocop:disable Naming/BlockForwarding end private diff --git a/spec/selectors/heading_spec.rb b/spec/selectors/heading_spec.rb index 468e30f..319f64f 100644 --- a/spec/selectors/heading_spec.rb +++ b/spec/selectors/heading_spec.rb @@ -112,7 +112,7 @@
Heading
HTML - expect(page).to have_heading level: level, count: 1 + expect(page).to have_heading level:, count: 1 end it "filters for an h#{level}" do @@ -121,7 +121,7 @@ Heading HTML - expect(page).to have_heading level: level, count: 1 + expect(page).to have_heading level:, count: 1 end it "filters for a native heading with overridden aria-level" do @@ -131,7 +131,7 @@ Heading HTML - expect(page).to have_heading level: level, count: 1 + expect(page).to have_heading level:, count: 1 end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 984be05..2a96e47 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -39,19 +39,19 @@ def squish options = Selenium::WebDriver::Firefox::Options.new( binary: "/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox" ) - Capybara::Selenium::Driver.new(app, browser: :firefox, options: options) + Capybara::Selenium::Driver.new(app, browser: :firefox, options:) end Capybara.register_driver(:firefox_aurora_headless) do |app| options = Selenium::WebDriver::Firefox::Options.new( binary: "/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox", args: ["--headless"] ) - Capybara::Selenium::Driver.new(app, browser: :firefox, options: options) + Capybara::Selenium::Driver.new(app, browser: :firefox, options:) end Capybara.register_driver(:edge) { |app| Capybara::Selenium::Driver.new(app, browser: :edge) } Capybara.register_driver(:edge_headless) do |app| options = Selenium::WebDriver::Edge::Options.new(args: ["--headless"]) - Capybara::Selenium::Driver.new(app, browser: :edge, options: options) + Capybara::Selenium::Driver.new(app, browser: :edge, options:) end Capybara.default_driver = driver Capybara.app = CapybaraAccessibleSelectors::TestApplication From 59e461d806dc826aea0223f22ddcad17608e272a Mon Sep 17 00:00:00 2001 From: Daniel Lewis Date: Tue, 2 Apr 2024 11:40:31 +0100 Subject: [PATCH 3/3] update readme to recommend using a tag --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 14f090a..dfce20d 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,8 @@ Include in your Gemfile: ```ruby group :test do - gem "capybara_accessible_selectors", git: "https://github.com/citizensadvice/capybara_accessible_selectors", branch: "main" + # It is recommended you use a tag as the main branch may contain breaking changes + gem "capybara_accessible_selectors", git: "https://github.com/citizensadvice/capybara_accessible_selectors", tag: "v0.12.0" end ```