From 35ea702bbfcdece47da995ad9889ae0cbc103584 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Fri, 30 Oct 2026 08:56:03 +0100 Subject: [PATCH] style: use have_no_css for CSS negative matchers Capybara's default selector is :css, so have_no_css is the explicit form of have_no_selector for these CSS selectors and behaviour does not change. rubocop-capybara 3.1.0 teaches Capybara/RSpec/HaveSelector to detect have_no_selector, which flags these six lines; landing the correction ahead of the ruby-deps group bump keeps that PR to dependencies alone. --- spec/components/admin/stats/table_component_spec.rb | 2 +- spec/features/admin/stats_page_spec.rb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/components/admin/stats/table_component_spec.rb b/spec/components/admin/stats/table_component_spec.rb index 68f02a76a..07be23ca0 100644 --- a/spec/components/admin/stats/table_component_spec.rb +++ b/spec/components/admin/stats/table_component_spec.rb @@ -41,7 +41,7 @@ render_inline(described_class.new(months: [Date.new(2026, 6, 1)], rows: [workshops_row], caption: 'Workshops')) - expect(attendance_table).to have_no_selector('td[colspan]') + expect(attendance_table).to have_no_css('td[colspan]') expect(page).to have_css('caption', text: 'Workshops') end diff --git a/spec/features/admin/stats_page_spec.rb b/spec/features/admin/stats_page_spec.rb index 643b20d39..c8485312b 100644 --- a/spec/features/admin/stats_page_spec.rb +++ b/spec/features/admin/stats_page_spec.rb @@ -20,8 +20,8 @@ expect(page).to have_css('caption', text: 'New sign-ups') expect(page).to have_css('caption', text: 'Workshops') expect(page).to have_css('th', text: 'August 2026') - expect(page).to have_no_selector('th', text: 'September 2026') - expect(page).to have_no_selector('th', text: 'May 2026') + expect(page).to have_no_css('th', text: 'September 2026') + expect(page).to have_no_css('th', text: 'May 2026') expect(page).to have_css('.btn-outline-primary.active', text: '3 months') expect(page).to have_link('Download CSV') end @@ -38,7 +38,7 @@ expect(page).to have_css('th', text: 'June 2026') expect(page).to have_css('th', text: 'July 2026') expect(page).to have_css('th', text: 'August 2026') - expect(page).to have_no_selector('th', text: 'May 2026') + expect(page).to have_no_css('th', text: 'May 2026') end end @@ -50,8 +50,8 @@ visit admin_stats_path(stats: { start_month: '2026-06', end_month: '2026-06' }) expect(page).to have_css('th', text: 'June 2026') - expect(page).to have_no_selector('th', text: 'May 2026') - expect(page).to have_no_selector('th', text: 'July 2026') + expect(page).to have_no_css('th', text: 'May 2026') + expect(page).to have_no_css('th', text: 'July 2026') expect(find('tr', text: 'New coaches')).to have_text('1') expect(find('tr', text: 'New students')).to have_text('0')