From be79932144ee55be54424d7bd1ea92cbe9cd2ef2 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 09:05:08 +0200 Subject: [PATCH 1/7] style: Fix Capybara/RSpec/NegationMatcherAfterVisit offense Fix Capybara/RSpec/NegationMatcherAfterVisit in spec/features/admin/chapters_spec.rb and regenerate .rubocop_todo.yml. --- .rubocop_todo.yml | 17 ++--------------- spec/features/admin/chapters_spec.rb | 3 ++- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c9e8bc6e5..114127e61 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit` -# on 2026-07-28 06:52:06 UTC using RuboCop version 1.88.2. +# on 2026-07-28 07:05:06 UTC using RuboCop version 1.88.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -81,7 +81,7 @@ Capybara/RSpec/HaveSelector: - 'spec/support/shared_examples/behaves_like_an_invitation_route.rb' - 'spec/views/dashboard/show.html.haml_spec.rb' -# Offense count: 49 +# Offense count: 48 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: have_no, not_to @@ -110,11 +110,6 @@ Capybara/RSpec/NegationMatcher: - 'spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb' - 'spec/support/shared_examples/behaves_link_member_viewing_workshop.rb' -# Offense count: 1 -Capybara/RSpec/NegationMatcherAfterVisit: - Exclude: - - 'spec/features/admin/chapters_spec.rb' - # Offense count: 1 Capybara/RSpec/VisibilityMatcher: Exclude: @@ -258,14 +253,6 @@ Lint/UnusedBlockArgument: - 'spec/fabricators/member_fabricator.rb' - 'spec/fabricators/sponsor_fabricator.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions. -# NotImplementedExceptions: NotImplementedError -Lint/UnusedMethodArgument: - Exclude: - - 'spec/support/select_from_tom_select.rb' - # Offense count: 9 # This cop supports safe autocorrection (--autocorrect). Lint/UselessAssignment: diff --git a/spec/features/admin/chapters_spec.rb b/spec/features/admin/chapters_spec.rb index 50e81dd2a..2ed918d40 100644 --- a/spec/features/admin/chapters_spec.rb +++ b/spec/features/admin/chapters_spec.rb @@ -141,7 +141,8 @@ scenario 'does not show the card when there are no responses' do visit admin_chapter_path(chapter) - expect(page).not_to have_content('How members found this chapter') + expect(page).to have_css('body') + expect(page).to have_no_content('How members found this chapter') end end From a81aa369abb6c94b245430e6d306797488480b28 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 09:05:18 +0200 Subject: [PATCH 2/7] style: Fix Capybara/RSpec/VisibilityMatcher offense --- .rubocop_todo.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 114127e61..727e9fca4 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -110,10 +110,6 @@ Capybara/RSpec/NegationMatcher: - 'spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb' - 'spec/support/shared_examples/behaves_link_member_viewing_workshop.rb' -# Offense count: 1 -Capybara/RSpec/VisibilityMatcher: - Exclude: - - 'spec/components/chapters_sidebar_component_spec.rb' # Offense count: 6 # This cop supports safe autocorrection (--autocorrect). From d1c13211a2915a04fa81a00b61dfa9011ef9ae1e Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 09:05:39 +0200 Subject: [PATCH 3/7] style: Fix Capybara/SpecificFinders offenses Fix 6 offenses and regenerate .rubocop_todo.yml. --- .rubocop_todo.yml | 13 ++++--------- .../features/admin/tom_select_member_lookup_spec.rb | 2 +- spec/features/member_feedback_spec.rb | 2 +- spec/features/member_joining_spec.rb | 4 ++-- spec/features/subscribing_to_newsletter_spec.rb | 4 ++-- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 727e9fca4..d8a4c784d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit` -# on 2026-07-28 07:05:06 UTC using RuboCop version 1.88.2. +# on 2026-07-28 07:05:37 UTC using RuboCop version 1.88.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -110,15 +110,10 @@ Capybara/RSpec/NegationMatcher: - 'spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb' - 'spec/support/shared_examples/behaves_link_member_viewing_workshop.rb' - -# Offense count: 6 -# This cop supports safe autocorrection (--autocorrect). -Capybara/SpecificFinders: +# Offense count: 1 +Capybara/RSpec/VisibilityMatcher: Exclude: - - 'spec/features/admin/tom_select_member_lookup_spec.rb' - - 'spec/features/member_feedback_spec.rb' - - 'spec/features/member_joining_spec.rb' - - 'spec/features/subscribing_to_newsletter_spec.rb' + - 'spec/components/chapters_sidebar_component_spec.rb' # Offense count: 14 # This cop supports safe autocorrection (--autocorrect). diff --git a/spec/features/admin/tom_select_member_lookup_spec.rb b/spec/features/admin/tom_select_member_lookup_spec.rb index ca35d1896..0d6640ef0 100644 --- a/spec/features/admin/tom_select_member_lookup_spec.rb +++ b/spec/features/admin/tom_select_member_lookup_spec.rb @@ -40,6 +40,6 @@ find('.ts-dropdown .option', text: 'Jane Doe').click - expect(find('#view_profile')[:href]).to include(admin_member_path(member_jane)) + expect(find_by_id('view_profile')[:href]).to include(admin_member_path(member_jane)) end end diff --git a/spec/features/member_feedback_spec.rb b/spec/features/member_feedback_spec.rb index ee50baf4f..d2e15e883 100644 --- a/spec/features/member_feedback_spec.rb +++ b/spec/features/member_feedback_spec.rb @@ -76,7 +76,7 @@ visit feedback_path(valid_token) # Get all coach options in order - select_options = page.find('#feedback_coach_id').all('option').map(&:text).reject(&:blank?) + select_options = page.find_by_id('feedback_coach_id').all('option').map(&:text).reject(&:blank?) verified_index = select_options.index(verified_coach.full_name) unverified_index = select_options.index(unverified_coach.full_name) diff --git a/spec/features/member_joining_spec.rb b/spec/features/member_joining_spec.rb index bf844bae7..0eb688d8c 100644 --- a/spec/features/member_joining_spec.rb +++ b/spec/features/member_joining_spec.rb @@ -44,9 +44,9 @@ check 'Vegan' check 'Other' fill_in 'Other dietary restrictions', with: 'peanut allergy' - find('#member_how_you_found_us_from_a_friend').click + find_by_id('member_how_you_found_us_from_a_friend').click - find('#member_how_you_found_us_other').click + find_by_id('member_how_you_found_us_other').click expect(page).to have_content('Please specify how you found us') fill_in 'member_how_you_found_us_other_reason', with: 'found on a poster', id: true click_on 'Next' diff --git a/spec/features/subscribing_to_newsletter_spec.rb b/spec/features/subscribing_to_newsletter_spec.rb index 7a166d009..c705e4115 100644 --- a/spec/features/subscribing_to_newsletter_spec.rb +++ b/spec/features/subscribing_to_newsletter_spec.rb @@ -27,7 +27,7 @@ fill_in 'member_surname', with: 'Doe' fill_in 'member_email', with: 'jane@codebar.io' fill_in 'member_about_you', with: Faker::Lorem.paragraph - find('#member_how_you_found_us_from_a_friend').click + find_by_id('member_how_you_found_us_from_a_friend').click click_on 'Next' end @@ -47,7 +47,7 @@ fill_in 'member_surname', with: 'Doe' fill_in 'member_email', with: 'jane@codebar.io' fill_in 'member_about_you', with: Faker::Lorem.paragraph - find('#member_how_you_found_us_other').click + find_by_id('member_how_you_found_us_other').click fill_in 'member_how_you_found_us_other_reason', with: Faker::Lorem.paragraph, id: true uncheck 'newsletter' From ae9999cefe626196638e82597a87b20e9a2e2011 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 09:05:58 +0200 Subject: [PATCH 4/7] style: Fix Capybara/RSpec/CurrentPathExpectation offenses Fix 17 offenses and regenerate .rubocop_todo.yml. --- .rubocop_todo.yml | 11 +---------- spec/features/admin/workshops_spec.rb | 6 +++--- spec/features/member_feedback_spec.rb | 2 +- spec/features/view_event_spec.rb | 14 +++++++------- .../behaves_like_an_invitation_route.rb | 12 ++++++------ 5 files changed, 18 insertions(+), 27 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d8a4c784d..b8f72422c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,20 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit` -# on 2026-07-28 07:05:37 UTC using RuboCop version 1.88.2. +# on 2026-07-28 07:05:56 UTC using RuboCop version 1.88.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 17 -# This cop supports safe autocorrection (--autocorrect). -Capybara/RSpec/CurrentPathExpectation: - Exclude: - - 'spec/features/admin/workshops_spec.rb' - - 'spec/features/member_feedback_spec.rb' - - 'spec/features/view_event_spec.rb' - - 'spec/support/shared_examples/behaves_like_an_invitation_route.rb' - # Offense count: 339 # This cop supports safe autocorrection (--autocorrect). Capybara/RSpec/HaveContent: diff --git a/spec/features/admin/workshops_spec.rb b/spec/features/admin/workshops_spec.rb index 47bdedb5e..6350ac27d 100644 --- a/spec/features/admin/workshops_spec.rb +++ b/spec/features/admin/workshops_spec.rb @@ -227,7 +227,7 @@ workshop = Fabricate(:workshop) visit admin_workshop_attendees_checklist_path(workshop) - expect(page.current_path).to eq(admin_workshop_path(workshop)) + expect(page).to have_current_path(admin_workshop_path(workshop), ignore_query: true) expect(page).to have_content('The requested format is invalid: text/html') end end @@ -238,7 +238,7 @@ visit admin_workshop_path(workshop) click_on 'Pairing CSV' - expect(page.current_path).to eq(admin_workshop_path(workshop, format: 'csv')) + expect(page).to have_current_path(admin_workshop_path(workshop, format: 'csv'), ignore_query: true) expect(page).to have_content(WorkshopPresenter::PAIRING_HEADINGS.join(',')) expect(page).not_to have_content('ORGANISER') end @@ -254,7 +254,7 @@ visit admin_workshop_path(workshop) click_on 'Labels' - expect(page.current_path).to eq(admin_workshop_path(workshop, format: 'csv')) + expect(page).to have_current_path(admin_workshop_path(workshop, format: 'csv'), ignore_query: true) expect(page).to have_content('ORGANISER') expect(page).not_to have_content(WorkshopPresenter::PAIRING_HEADINGS.join(',')) end diff --git a/spec/features/member_feedback_spec.rb b/spec/features/member_feedback_spec.rb index d2e15e883..41b3825ea 100644 --- a/spec/features/member_feedback_spec.rb +++ b/spec/features/member_feedback_spec.rb @@ -127,7 +127,7 @@ click_button('Submit feedback') - expect(page.current_path).to eq(submit_feedback_path(valid_token)) + expect(page).to have_current_path(submit_feedback_path(valid_token), ignore_query: true) expect(page).to have_content("Rating can't be blank") end end diff --git a/spec/features/view_event_spec.rb b/spec/features/view_event_spec.rb index 0025b557c..4441a4a61 100644 --- a/spec/features/view_event_spec.rb +++ b/spec/features/view_event_spec.rb @@ -36,7 +36,7 @@ context 'can RSVP to an event' do scenario 'as a Coach' do - expect(current_path).to eq(event_path(closed_event)) + expect(page).to have_current_path(event_path(closed_event), ignore_query: true) click_on 'Attend as a coach' click_on 'RSVP' @@ -45,7 +45,7 @@ end scenario 'as a Student' do - expect(current_path).to eq(event_path(closed_event)) + expect(page).to have_current_path(event_path(closed_event), ignore_query: true) click_on 'Attend as a student' click_on 'RSVP' @@ -56,7 +56,7 @@ context 'can not RSVP to an event' do it 'that is now in the past' do - expect(current_path).to eq(event_path(closed_event)) + expect(page).to have_current_path(event_path(closed_event), ignore_query: true) travel_into_the_future = Time.zone.now + 3.days allow(Time).to receive(:now).and_return(travel_into_the_future) @@ -84,7 +84,7 @@ context 'can RSVP to an event' do scenario 'as a Coach' do - expect(current_path).to eq(event_path(open_event)) + expect(page).to have_current_path(event_path(open_event), ignore_query: true) click_on 'Attend as a coach' click_on 'RSVP' @@ -94,7 +94,7 @@ end scenario 'as a Student' do - expect(current_path).to eq(event_path(open_event)) + expect(page).to have_current_path(event_path(open_event), ignore_query: true) click_on 'Attend as a student' click_on 'RSVP' @@ -106,7 +106,7 @@ context 'can not RSVP to an event' do it 'that is now in the past' do - expect(current_path).to eq(event_path(open_event)) + expect(page).to have_current_path(event_path(open_event), ignore_query: true) travel_into_the_future = Time.zone.now + 3.days allow(Time).to receive(:now).and_return(travel_into_the_future) @@ -122,7 +122,7 @@ invitation = Fabricate(:attending_event_invitation, event: open_event, member: member) visit event_path(open_event) - expect(current_path).to eq(event_invitation_path(open_event, invitation.token)) + expect(page).to have_current_path(event_invitation_path(open_event, invitation.token), ignore_query: true) end end end diff --git a/spec/support/shared_examples/behaves_like_an_invitation_route.rb b/spec/support/shared_examples/behaves_like_an_invitation_route.rb index 968fb15f3..f31e8ff6b 100644 --- a/spec/support/shared_examples/behaves_like_an_invitation_route.rb +++ b/spec/support/shared_examples/behaves_like_an_invitation_route.rb @@ -17,7 +17,7 @@ expect(page).to have_link 'I can no longer attend' expect(page).to have_content("Thanks for getting back to us #{invitation.member.name}.") - expect(page.current_path).to eq(invitation_route) + expect(page).to have_current_path(invitation_route, ignore_query: true) # admin view login_as_admin(member) @@ -43,7 +43,7 @@ visit accept_invitation_route expect(page).to have_link 'I can no longer attend' - expect(page.current_path).to eq(invitation_route) + expect(page).to have_current_path(invitation_route, ignore_query: true) expect(page).to have_content(I18n.t('messages.accepted_invitation', name: member.name)) end end @@ -102,7 +102,7 @@ visit reject_invitation_route expect(page).to have_content(I18n.t('messages.rejected_invitation', name: invitation.member.name)) - expect(page.current_path).to eq(invitation_route) + expect(page).to have_current_path(invitation_route, ignore_query: true) end scenario 'when already confirmed they are not attending' do @@ -118,7 +118,7 @@ visit reject_invitation_route expect(page).to have_content(I18n.t('messages.not_attending_already')) - expect(page.current_path).to eq(invitation_route) + expect(page).to have_current_path(invitation_route, ignore_query: true) end scenario 'when already RSVPd to another event on same evening' do @@ -149,7 +149,7 @@ visit reject_invitation_route expect(page).to have_content('You can only change your RSVP status up to 3.5 hours before the workshop') - expect(page.current_path).to eq(invitation_route) + expect(page).to have_current_path(invitation_route, ignore_query: true) end scenario 'when the event is less than 3.5 hours from now and tje reject by accessing the link directly' do @@ -157,7 +157,7 @@ visit reject_invitation_route expect(page).to have_content('You can only change your RSVP status up to 3.5 hours before the workshop') - expect(page.current_path).to eq(invitation_route) + expect(page).to have_current_path(invitation_route, ignore_query: true) end end From 6d75abd8649e7af0ebd236cb11e4bc9e372938e4 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 09:06:16 +0200 Subject: [PATCH 5/7] style: Fix Capybara/RSpec/HaveSelector offenses Fix 21 offenses and regenerate .rubocop_todo.yml. --- .rubocop_todo.yml | 17 +---------------- .../admin/manage_workshop_attendances_spec.rb | 8 ++++---- spec/features/admin/members_spec.rb | 8 ++++---- spec/features/listing_events_spec.rb | 6 +++--- spec/features/member_feedback_spec.rb | 2 +- spec/features/member_joining_spec.rb | 4 ++-- spec/features/member_portal_spec.rb | 4 ++-- spec/features/member_updating_details_spec.rb | 4 ++-- .../behaves_like_an_invitation_route.rb | 4 ++-- spec/views/dashboard/show.html.haml_spec.rb | 2 +- 10 files changed, 22 insertions(+), 37 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index b8f72422c..771a9c250 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit` -# on 2026-07-28 07:05:56 UTC using RuboCop version 1.88.2. +# on 2026-07-28 07:06:14 UTC using RuboCop version 1.88.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -57,21 +57,6 @@ Capybara/RSpec/HaveContent: - 'spec/support/shared_examples/behaves_like_viewing_workshop_actions.rb' - 'spec/support/shared_examples/behaves_like_viewing_workshop_details.rb' -# Offense count: 21 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: DefaultSelector. -Capybara/RSpec/HaveSelector: - Exclude: - - 'spec/features/admin/manage_workshop_attendances_spec.rb' - - 'spec/features/admin/members_spec.rb' - - 'spec/features/listing_events_spec.rb' - - 'spec/features/member_feedback_spec.rb' - - 'spec/features/member_joining_spec.rb' - - 'spec/features/member_portal_spec.rb' - - 'spec/features/member_updating_details_spec.rb' - - 'spec/support/shared_examples/behaves_like_an_invitation_route.rb' - - 'spec/views/dashboard/show.html.haml_spec.rb' - # Offense count: 48 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. diff --git a/spec/features/admin/manage_workshop_attendances_spec.rb b/spec/features/admin/manage_workshop_attendances_spec.rb index e0e26f2ff..ec6cebd96 100644 --- a/spec/features/admin/manage_workshop_attendances_spec.rb +++ b/spec/features/admin/manage_workshop_attendances_spec.rb @@ -28,7 +28,7 @@ # Capture the ID of the second row before clicking second_row_id = "attendee-row-#{second_invitation.id}" - expect(page).to have_selector("##{second_row_id}") + expect(page).to have_css("##{second_row_id}") # Verify first attendee first('.verify_attendance').click @@ -39,7 +39,7 @@ expect(page).to have_css('.fa-check-square', count: 0, wait: 5) # The unclicked row should still exist with its original ID, proving targeted replacement - expect(page).to have_selector("##{second_row_id}") + expect(page).to have_css("##{second_row_id}") end end @@ -60,7 +60,7 @@ expect(page).to have_content('2 are attending as students') expect(page).to have_content(I18n.l(other_invitation.reload.rsvp_time)) - expect(page).to have_selector('i.fa-hat-wizard') + expect(page).to have_css('i.fa-hat-wizard') end scenario 'can rsvp an invited student to the workshop', js: true do @@ -70,7 +70,7 @@ visit admin_workshop_path(workshop) expect(page).to have_content('1 are attending as students') - expect(page).to_not have_selector('i.fa-magic') + expect(page).to_not have_css('i.fa-magic') # Use the select_from_chosen helper to select the member select_from_chosen("#{other_invitation.member.full_name} (#{other_invitation.role})", from: 'workshop_invitations') diff --git a/spec/features/admin/members_spec.rb b/spec/features/admin/members_spec.rb index a324fa0c8..fe5cef4a6 100644 --- a/spec/features/admin/members_spec.rb +++ b/spec/features/admin/members_spec.rb @@ -19,8 +19,8 @@ expect(page).to have_content(member.email) expect(page).to have_content(member.about_you) - expect(page).to have_selector('.badge', text: 'Vegan') - expect(page).to have_selector('.badge', text: 'Peanut allergy') + expect(page).to have_css('.badge', text: 'Vegan') + expect(page).to have_css('.badge', text: 'Peanut allergy') end it 'can view a summary of member event attendances' do @@ -81,9 +81,9 @@ end it 'can send an attendance warning to a member' do - expect(page).to have_selector("a[data-confirm='Clicking OK will send an automated email to this user now to warn them about missing too many workshops. This cannot be undone. Are you sure?']") + expect(page).to have_css("a[data-confirm='Clicking OK will send an automated email to this user now to warn them about missing too many workshops. This cannot be undone. Are you sure?']") click_on 'Send attendance warning' - expect(page).to have_selector("a[data-confirm='#{member.name} has already received a warning about missing too many workshops on #{member.attendance_warnings.last.created_at.strftime('%Y-%m-%d at %H:%M')}. Are you sure you want to proceed with sending another one?']") + expect(page).to have_css("a[data-confirm='#{member.name} has already received a warning about missing too many workshops on #{member.attendance_warnings.last.created_at.strftime('%Y-%m-%d at %H:%M')}. Are you sure you want to proceed with sending another one?']") expect(page).to have_content 'Attendance warning email sent.' within '.attendance-warning' do diff --git a/spec/features/listing_events_spec.rb b/spec/features/listing_events_spec.rb index 05e4636ae..95e7b64ee 100644 --- a/spec/features/listing_events_spec.rb +++ b/spec/features/listing_events_spec.rb @@ -43,7 +43,7 @@ Fabricate(:workshop, date_and_time: 3.weeks.ago, chapter: chapter) visit past_events_path - expect(page).to have_selector('.card', count: 20) + expect(page).to have_css('.card', count: 20) end end @@ -52,7 +52,7 @@ Fabricate.times(22, :meeting, date_and_time: 2.weeks.ago) visit past_events_path - expect(page).to have_selector('.card', count: 20) + expect(page).to have_css('.card', count: 20) end end @@ -61,7 +61,7 @@ Fabricate.times(22, :meeting, date_and_time: 2.weeks.from_now) visit upcoming_events_path - expect(page).to have_selector('.card', count: 20) + expect(page).to have_css('.card', count: 20) end end end diff --git a/spec/features/member_feedback_spec.rb b/spec/features/member_feedback_spec.rb index 41b3825ea..dd26df765 100644 --- a/spec/features/member_feedback_spec.rb +++ b/spec/features/member_feedback_spec.rb @@ -23,7 +23,7 @@ expect(page).to have_select 'feedback_tutorial_id' expect(page).to have_field 'feedback_request' expect(page).to have_field 'feedback_suggestions' - expect(page).to have_selector '//div.rating' + expect(page).to have_css '//div.rating' expect(page).to have_button 'Submit feedback' end diff --git a/spec/features/member_joining_spec.rb b/spec/features/member_joining_spec.rb index 0eb688d8c..61527bf41 100644 --- a/spec/features/member_joining_spec.rb +++ b/spec/features/member_joining_spec.rb @@ -59,8 +59,8 @@ expect(page).to have_content('she') expect(page).to have_content('Jane Doe') expect(page).to have_link('jane@codebar.io') - expect(page).to have_selector('.badge', text: 'Vegan') - expect(page).to have_selector('.badge', text: 'Peanut allergy') + expect(page).to have_css('.badge', text: 'Vegan') + expect(page).to have_css('.badge', text: 'Peanut allergy') end scenario 'Picking a mailing list on step 2 subscribes you to that list' do diff --git a/spec/features/member_portal_spec.rb b/spec/features/member_portal_spec.rb index 21aa0b7e6..d8230d5a4 100644 --- a/spec/features/member_portal_spec.rb +++ b/spec/features/member_portal_spec.rb @@ -86,14 +86,14 @@ it 'can not access the member portal' do visit dashboard_path - expect(page).to_not have_selector('#profile') + expect(page).to_not have_css('#profile') end it 'is redirected to sign_in page when they attempt not access the profile page' do mock_github_auth visit profile_path - expect(page).to_not have_selector('#member_profile') + expect(page).to_not have_css('#member_profile') end end end diff --git a/spec/features/member_updating_details_spec.rb b/spec/features/member_updating_details_spec.rb index b6630d364..34ca91efa 100644 --- a/spec/features/member_updating_details_spec.rb +++ b/spec/features/member_updating_details_spec.rb @@ -12,7 +12,7 @@ click_on 'Save' expect(page).to have_content('Your details have been updated.') - expect(page).to have_selector(".badge", text: "Vegetarian") + expect(page).to have_css(".badge", text: "Vegetarian") end scenario 'A member adds a custom dietary restriction' do @@ -25,7 +25,7 @@ click_on 'Save' expect(page).to have_content('Your details have been updated.') - expect(page).to have_selector(".badge", text: 'Peanut allergy') + expect(page).to have_css(".badge", text: 'Peanut allergy') member.reload expect(member.dietary_restrictions).to eq(['other']) expect(member.other_dietary_restrictions).to eq('peanut allergy') diff --git a/spec/support/shared_examples/behaves_like_an_invitation_route.rb b/spec/support/shared_examples/behaves_like_an_invitation_route.rb index f31e8ff6b..3a49c6a55 100644 --- a/spec/support/shared_examples/behaves_like_an_invitation_route.rb +++ b/spec/support/shared_examples/behaves_like_an_invitation_route.rb @@ -24,8 +24,8 @@ visit admin_workshop_path(invitation.workshop) within 'div.row.attendee.mt-3' do expect(page).to have_content(member.full_name) - expect(page).to have_selector('i.fa-history') - expect(page).to_not have_selector('i.fa-magic') + expect(page).to have_css('i.fa-history') + expect(page).to_not have_css('i.fa-magic') end end diff --git a/spec/views/dashboard/show.html.haml_spec.rb b/spec/views/dashboard/show.html.haml_spec.rb index 64d02fa40..e89403103 100644 --- a/spec/views/dashboard/show.html.haml_spec.rb +++ b/spec/views/dashboard/show.html.haml_spec.rb @@ -14,7 +14,7 @@ end it 'renders the chapters sidebar component' do - expect(rendered).to have_selector('.col-lg-4.pl-lg-5') + expect(rendered).to have_css('.col-lg-4.pl-lg-5') chapters.each do |chapter| expect(rendered).to have_link(chapter.name, href: chapter_path(chapter.slug)) end From ac18382f291eda2777ff7d7698bbc7966a1b72d8 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 09:06:35 +0200 Subject: [PATCH 6/7] style: Fix Capybara/RSpec/NegationMatcher offenses Fix 49 offenses and regenerate .rubocop_todo.yml. --- .rubocop_todo.yml | 40 ++----------------- spec/components/event_card_component_spec.rb | 6 +-- spec/features/accepting_invitation_spec.rb | 2 +- .../accepting_terms_and_conditions_spec.rb | 2 +- spec/features/admin/accessing_portal_spec.rb | 2 +- spec/features/admin/announcements_spec.rb | 2 +- spec/features/admin/chapter/feedback_spec.rb | 2 +- spec/features/admin/chapters_spec.rb | 2 +- .../admin/manage_workshop_attendances_spec.rb | 2 +- .../admin/managing_organisers_spec.rb | 2 +- spec/features/admin/meeting_spec.rb | 2 +- spec/features/admin/sponsor_spec.rb | 10 ++--- .../admin/tom_select_member_lookup_spec.rb | 2 +- spec/features/admin/workshops_spec.rb | 4 +- spec/features/chapter_spec.rb | 4 +- spec/features/member_portal_spec.rb | 4 +- spec/features/sponsors_spec.rb | 2 +- spec/features/view_event_spec.rb | 16 ++++---- .../viewing_a_workshop_invitation_spec.rb | 6 +-- spec/features/visiting_homepage_spec.rb | 2 +- .../behaves_like_an_invitation_route.rb | 6 +-- ...haves_like_managing_workshop_attendance.rb | 14 +++---- .../behaves_link_member_viewing_workshop.rb | 2 +- 23 files changed, 52 insertions(+), 84 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 771a9c250..103ac53ce 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit` -# on 2026-07-28 07:06:14 UTC using RuboCop version 1.88.2. +# on 2026-07-28 07:06:33 UTC using RuboCop version 1.88.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -57,33 +57,11 @@ Capybara/RSpec/HaveContent: - 'spec/support/shared_examples/behaves_like_viewing_workshop_actions.rb' - 'spec/support/shared_examples/behaves_like_viewing_workshop_details.rb' -# Offense count: 48 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: have_no, not_to -Capybara/RSpec/NegationMatcher: +# Offense count: 4 +Capybara/RSpec/NegationMatcherAfterVisit: Exclude: - - 'spec/components/event_card_component_spec.rb' - - 'spec/features/accepting_invitation_spec.rb' - - 'spec/features/accepting_terms_and_conditions_spec.rb' - - 'spec/features/admin/accessing_portal_spec.rb' - - 'spec/features/admin/announcements_spec.rb' - - 'spec/features/admin/chapter/feedback_spec.rb' - - 'spec/features/admin/chapters_spec.rb' - - 'spec/features/admin/manage_workshop_attendances_spec.rb' - - 'spec/features/admin/managing_organisers_spec.rb' - - 'spec/features/admin/meeting_spec.rb' - - 'spec/features/admin/sponsor_spec.rb' - - 'spec/features/admin/tom_select_member_lookup_spec.rb' - - 'spec/features/admin/workshops_spec.rb' - - 'spec/features/chapter_spec.rb' - 'spec/features/member_portal_spec.rb' - - 'spec/features/sponsors_spec.rb' - - 'spec/features/view_event_spec.rb' - - 'spec/features/viewing_a_workshop_invitation_spec.rb' - - 'spec/features/visiting_homepage_spec.rb' - 'spec/support/shared_examples/behaves_like_an_invitation_route.rb' - - 'spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb' - 'spec/support/shared_examples/behaves_link_member_viewing_workshop.rb' # Offense count: 1 @@ -828,21 +806,12 @@ RSpec/NamedSubject: - 'spec/policies/testimonial_policy_spec.rb' - 'spec/policies/workshop_policy_spec.rb' -# Offense count: 42 +# Offense count: 21 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: not_to, to_not RSpec/NotToNot: Exclude: - - 'spec/features/admin/accessing_portal_spec.rb' - - 'spec/features/admin/chapter/feedback_spec.rb' - - 'spec/features/admin/manage_workshop_attendances_spec.rb' - - 'spec/features/admin/managing_organisers_spec.rb' - - 'spec/features/admin/sponsor_spec.rb' - - 'spec/features/member_portal_spec.rb' - - 'spec/features/sponsors_spec.rb' - - 'spec/features/view_event_spec.rb' - - 'spec/features/viewing_a_workshop_invitation_spec.rb' - 'spec/lib/tasks/mailing_list_rake_spec.rb' - 'spec/models/ban_spec.rb' - 'spec/models/event_spec.rb' @@ -852,7 +821,6 @@ RSpec/NotToNot: - 'spec/models/tutorial_spec.rb' - 'spec/support/shared_examples/behaves_like_an_invitation_route.rb' - 'spec/support/shared_examples/behaves_like_invitable.rb' - - 'spec/support/shared_examples/behaves_link_member_viewing_workshop.rb' # Offense count: 4 RSpec/RepeatedExample: diff --git a/spec/components/event_card_component_spec.rb b/spec/components/event_card_component_spec.rb index 496a5f9d9..df6e0a5fd 100644 --- a/spec/components/event_card_component_spec.rb +++ b/spec/components/event_card_component_spec.rb @@ -18,8 +18,8 @@ it "does not render user-specific badges without a user" do render_inline(described_class.new(event_card: presenter)) - expect(page).not_to have_text("Attending") - expect(page).not_to have_text("Manage") + expect(page).to have_no_text("Attending") + expect(page).to have_no_text("Manage") end it "renders chapter badge" do @@ -46,7 +46,7 @@ it "does not render sponsor logos for meetings" do render_inline(described_class.new(event_card: presenter)) # Venue image has sponsor-sm class, so check for mx-1 spacing (used only by sponsors) - expect(page).not_to have_css(".mx-1") + expect(page).to have_no_css(".mx-1") end end diff --git a/spec/features/accepting_invitation_spec.rb b/spec/features/accepting_invitation_spec.rb index 4961e5204..efb0ce851 100644 --- a/spec/features/accepting_invitation_spec.rb +++ b/spec/features/accepting_invitation_spec.rb @@ -30,7 +30,7 @@ expect(page).to have_content('The workshop is full') expect(page).to have_button('Join the waiting list') - expect(page).not_to have_button('Attend') + expect(page).to have_no_button('Attend') end end diff --git a/spec/features/accepting_terms_and_conditions_spec.rb b/spec/features/accepting_terms_and_conditions_spec.rb index 2b24f022c..bf5ae6880 100644 --- a/spec/features/accepting_terms_and_conditions_spec.rb +++ b/spec/features/accepting_terms_and_conditions_spec.rb @@ -75,7 +75,7 @@ visit terms_and_conditions_path expect(page).to have_current_path(terms_and_conditions_path) expect(page).to have_content(/already accepted.*#{member.accepted_toc_at.strftime('%d %B %Y')}/) - expect(page).not_to have_button('Accept') + expect(page).to have_no_button('Accept') end end end diff --git a/spec/features/admin/accessing_portal_spec.rb b/spec/features/admin/accessing_portal_spec.rb index 1e9331a24..a147d1b17 100644 --- a/spec/features/admin/accessing_portal_spec.rb +++ b/spec/features/admin/accessing_portal_spec.rb @@ -24,7 +24,7 @@ end inactive_chapter.groups.each do |group| - expect(page).to_not have_content(group.to_s) + expect(page).to have_no_content(group.to_s) end end diff --git a/spec/features/admin/announcements_spec.rb b/spec/features/admin/announcements_spec.rb index 800039879..fe31fdbec 100644 --- a/spec/features/admin/announcements_spec.rb +++ b/spec/features/admin/announcements_spec.rb @@ -73,7 +73,7 @@ expect(page).to have_content('An announcement to selected groups') expect(page).to have_content("Coaches #{chapter.name}") - expect(page).not_to have_content("Students #{chapter.name}") + expect(page).to have_no_content("Students #{chapter.name}") expect(page).to have_current_path(admin_announcements_path, ignore_query: true) end end diff --git a/spec/features/admin/chapter/feedback_spec.rb b/spec/features/admin/chapter/feedback_spec.rb index 4898a8a51..746e27d29 100644 --- a/spec/features/admin/chapter/feedback_spec.rb +++ b/spec/features/admin/chapter/feedback_spec.rb @@ -14,7 +14,7 @@ click_on "#{chapter.name} feedback" feedbacks.each { |feedback| expect(page).to have_content(feedback.request) } - other_feedbacks.each { |feedback| expect(page).to_not have_content(feedback.request) } + other_feedbacks.each { |feedback| expect(page).to have_no_content(feedback.request) } end it 'displays a message if no feedback has been submitted yet' do diff --git a/spec/features/admin/chapters_spec.rb b/spec/features/admin/chapters_spec.rb index 2ed918d40..1f6ebcdb4 100644 --- a/spec/features/admin/chapters_spec.rb +++ b/spec/features/admin/chapters_spec.rb @@ -116,7 +116,7 @@ expect(page).to have_content(email) end - expect(page).not_to have_content(coach_email) + expect(page).to have_no_content(coach_email) end end diff --git a/spec/features/admin/manage_workshop_attendances_spec.rb b/spec/features/admin/manage_workshop_attendances_spec.rb index ec6cebd96..9072aa1b0 100644 --- a/spec/features/admin/manage_workshop_attendances_spec.rb +++ b/spec/features/admin/manage_workshop_attendances_spec.rb @@ -70,7 +70,7 @@ visit admin_workshop_path(workshop) expect(page).to have_content('1 are attending as students') - expect(page).to_not have_css('i.fa-magic') + expect(page).to have_no_css('i.fa-magic') # Use the select_from_chosen helper to select the member select_from_chosen("#{other_invitation.member.full_name} (#{other_invitation.role})", from: 'workshop_invitations') diff --git a/spec/features/admin/managing_organisers_spec.rb b/spec/features/admin/managing_organisers_spec.rb index b8d973899..79da8e6ff 100644 --- a/spec/features/admin/managing_organisers_spec.rb +++ b/spec/features/admin/managing_organisers_spec.rb @@ -46,7 +46,7 @@ click_on 'Remove' within '.organisers' do - expect(page).to_not have_content(organiser_name) + expect(page).to have_no_content(organiser_name) end end end diff --git a/spec/features/admin/meeting_spec.rb b/spec/features/admin/meeting_spec.rb index 5ed4e1473..f8a2c31fb 100644 --- a/spec/features/admin/meeting_spec.rb +++ b/spec/features/admin/meeting_spec.rb @@ -59,7 +59,7 @@ expect(page).to have_content('You have successfully updated the details of this meeting') expect(page).to have_css(%(span[title="#{permissions.members.last.full_name}"])) - expect(page).not_to have_css(%(span[title="#{permissions.members.first.full_name}"])) + expect(page).to have_no_css(%(span[title="#{permissions.members.first.full_name}"])) end scenario 'adding an organiser', :js do diff --git a/spec/features/admin/sponsor_spec.rb b/spec/features/admin/sponsor_spec.rb index 477860803..e65fe5864 100644 --- a/spec/features/admin/sponsor_spec.rb +++ b/spec/features/admin/sponsor_spec.rb @@ -109,9 +109,9 @@ scenario 'when no sponsorships' do within '#sponsorships' do expect(page).to have_content('No sponsorships') - expect(page).to_not have_content('Workshops') - expect(page).to_not have_content('Events') - expect(page).to_not have_content('Meetings') + expect(page).to have_no_content('Workshops') + expect(page).to have_no_content('Events') + expect(page).to have_no_content('Meetings') end end @@ -177,7 +177,7 @@ visit admin_sponsor_path(sponsor) within '#activities' do - expect(page).to_not have_content("#{manager.full_name} subscribed #{contact.name} #{contact.surname} with email #{contact.email} to the Sponsor newsletter") + expect(page).to have_no_content("#{manager.full_name} subscribed #{contact.name} #{contact.surname} with email #{contact.email} to the Sponsor newsletter") end end end @@ -231,7 +231,7 @@ expect(page).to have_content(sponsor.name) expect(page).to have_content(sponsor.contacts.first.name) - expect(page).to_not have_content(sponsor_no_contacts.name) + expect(page).to have_no_content(sponsor_no_contacts.name) end end end diff --git a/spec/features/admin/tom_select_member_lookup_spec.rb b/spec/features/admin/tom_select_member_lookup_spec.rb index 0d6640ef0..a011fff49 100644 --- a/spec/features/admin/tom_select_member_lookup_spec.rb +++ b/spec/features/admin/tom_select_member_lookup_spec.rb @@ -25,7 +25,7 @@ expect(page).to have_content('Jane Doe') expect(page).to have_content('jane@example.com') - expect(page).not_to have_content('John Smith') + expect(page).to have_no_content('John Smith') end scenario 'selecting a member updates view profile link' do diff --git a/spec/features/admin/workshops_spec.rb b/spec/features/admin/workshops_spec.rb index 6350ac27d..928872100 100644 --- a/spec/features/admin/workshops_spec.rb +++ b/spec/features/admin/workshops_spec.rb @@ -240,7 +240,7 @@ expect(page).to have_current_path(admin_workshop_path(workshop, format: 'csv'), ignore_query: true) expect(page).to have_content(WorkshopPresenter::PAIRING_HEADINGS.join(',')) - expect(page).not_to have_content('ORGANISER') + expect(page).to have_no_content('ORGANISER') end end @@ -256,7 +256,7 @@ expect(page).to have_current_path(admin_workshop_path(workshop, format: 'csv'), ignore_query: true) expect(page).to have_content('ORGANISER') - expect(page).not_to have_content(WorkshopPresenter::PAIRING_HEADINGS.join(',')) + expect(page).to have_no_content(WorkshopPresenter::PAIRING_HEADINGS.join(',')) end end end diff --git a/spec/features/chapter_spec.rb b/spec/features/chapter_spec.rb index 087c83935..fd2661b4e 100644 --- a/spec/features/chapter_spec.rb +++ b/spec/features/chapter_spec.rb @@ -33,7 +33,7 @@ visit chapter_path(chapter.slug) expect(page).to have_content 'Empty Chapter' - expect(page).not_to have_content 'Team' + expect(page).to have_no_content 'Team' end it 'renders any upcoming workshops for the chapter' do @@ -73,7 +73,7 @@ visit chapter_path(chapter.slug) expect(page).to have_content "Workshop at #{recent_past_workshop.host.name}" - expect(page).not_to have_content "Workshop at #{past_workshop.host.name}" + expect(page).to have_no_content "Workshop at #{past_workshop.host.name}" end end diff --git a/spec/features/member_portal_spec.rb b/spec/features/member_portal_spec.rb index d8230d5a4..f7b3aeb7d 100644 --- a/spec/features/member_portal_spec.rb +++ b/spec/features/member_portal_spec.rb @@ -86,14 +86,14 @@ it 'can not access the member portal' do visit dashboard_path - expect(page).to_not have_css('#profile') + expect(page).to have_no_css('#profile') end it 'is redirected to sign_in page when they attempt not access the profile page' do mock_github_auth visit profile_path - expect(page).to_not have_css('#member_profile') + expect(page).to have_no_css('#member_profile') end end end diff --git a/spec/features/sponsors_spec.rb b/spec/features/sponsors_spec.rb index 2f6a454f2..6176a83e4 100644 --- a/spec/features/sponsors_spec.rb +++ b/spec/features/sponsors_spec.rb @@ -10,7 +10,7 @@ expect(page).to have_css("img[src*='#{gold_sponsor.avatar.url}']") expect(page).to have_css("img[src*='#{standard_sponsor.avatar.url}']") - expect(page).to_not have_css("img[src*='#{hidden_sponsor.avatar.url}']") + expect(page).to have_no_css("img[src*='#{hidden_sponsor.avatar.url}']") end end end diff --git a/spec/features/view_event_spec.rb b/spec/features/view_event_spec.rb index 4441a4a61..0fc214559 100644 --- a/spec/features/view_event_spec.rb +++ b/spec/features/view_event_spec.rb @@ -17,13 +17,13 @@ scenario 'a student cannot RSVP if they are not logged in' do expect(page).to have_link('Log in') expect(page).to have_link('Join our community') - expect(page).to_not have_link('Attend as a student') + expect(page).to have_no_link('Attend as a student') end scenario 'a coach cannot RSVP if they are not logged in' do expect(page).to have_link('Log in') expect(page).to have_link('Join our community') - expect(page).to_not have_link('Attend as a coach') + expect(page).to have_no_link('Attend as a coach') end end @@ -63,8 +63,8 @@ visit event_path(closed_event) expect(page).to have_content('This event has already occurred.') - expect(page).not_to have_button('Attend as a coach') - expect(page).not_to have_button('Attend as a student') + expect(page).to have_no_button('Attend as a coach') + expect(page).to have_no_button('Attend as a student') end end end @@ -90,7 +90,7 @@ click_on 'RSVP' expect(page).to have_content("Your spot has been confirmed for #{open_event.name}! We look forward to seeing you there") - expect(page).not_to have_content('We will verify your attendance after you complete the questionnaire!') + expect(page).to have_no_content('We will verify your attendance after you complete the questionnaire!') end scenario 'as a Student' do @@ -100,7 +100,7 @@ click_on 'RSVP' expect(page).to have_content("Your spot has been confirmed for #{open_event.name}! We look forward to seeing you there") - expect(page).not_to have_content('We will verify your attendance after you complete the questionnaire!') + expect(page).to have_no_content('We will verify your attendance after you complete the questionnaire!') end end @@ -113,8 +113,8 @@ visit event_path(open_event) expect(page).to have_content('This event has already occurred.') - expect(page).not_to have_button('Attend as a coach') - expect(page).not_to have_button('Attend as a student') + expect(page).to have_no_button('Attend as a coach') + expect(page).to have_no_button('Attend as a student') end end diff --git a/spec/features/viewing_a_workshop_invitation_spec.rb b/spec/features/viewing_a_workshop_invitation_spec.rb index 2ad0e6729..1fcab7b5f 100644 --- a/spec/features/viewing_a_workshop_invitation_spec.rb +++ b/spec/features/viewing_a_workshop_invitation_spec.rb @@ -45,7 +45,7 @@ within '#info' do expect(page).to have_content('Information about the workshop') expect(page).to have_link('Follow link', href: 'http://a.link.com') - expect(page).to_not have_content('How to join') + expect(page).to have_no_content('How to join') end end end @@ -64,13 +64,13 @@ context '#introduction' do context 'student' do scenario 'does not display information about the physical workshop' do - expect(page).to_not have_content('Please make sure you bring your laptop') + expect(page).to have_no_content('Please make sure you bring your laptop') end end context 'coach' do scenario 'does not displays information about the physical workshop' do - expect(page).to_not have_content('PS: There will also be food at the workshop.') + expect(page).to have_no_content('PS: There will also be food at the workshop.') end end end diff --git a/spec/features/visiting_homepage_spec.rb b/spec/features/visiting_homepage_spec.rb index 27d0590c6..fde1d8eaa 100644 --- a/spec/features/visiting_homepage_spec.rb +++ b/spec/features/visiting_homepage_spec.rb @@ -41,7 +41,7 @@ end inactive_chapters.each do |chapter| - expect(page).not_to have_content(chapter.name) + expect(page).to have_no_content(chapter.name) end end diff --git a/spec/support/shared_examples/behaves_like_an_invitation_route.rb b/spec/support/shared_examples/behaves_like_an_invitation_route.rb index 3a49c6a55..e9aa5796a 100644 --- a/spec/support/shared_examples/behaves_like_an_invitation_route.rb +++ b/spec/support/shared_examples/behaves_like_an_invitation_route.rb @@ -25,7 +25,7 @@ within 'div.row.attendee.mt-3' do expect(page).to have_content(member.full_name) expect(page).to have_css('i.fa-history') - expect(page).to_not have_css('i.fa-magic') + expect(page).to have_no_css('i.fa-magic') end end @@ -34,7 +34,7 @@ invitation.update(role: 'Student', attending: nil, tutorial: nil) visit accept_invitation_route - expect(page).to_not have_link 'I can no longer attend' + expect(page).to have_no_link 'I can no longer attend' expect(page).to have_content('Tutorial must be selected') end @@ -110,7 +110,7 @@ visit invitation_route expect(page).to have_selector(:link_or_button, 'Attend') - expect(page).to_not have_content 'I can no longer attend' + expect(page).to have_no_content 'I can no longer attend' end scenario 'when already confirmed they are not attending and reject by accessing the link directly' do diff --git a/spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb b/spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb index 4b74e3eee..5b23f1eef 100644 --- a/spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb +++ b/spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb @@ -23,7 +23,7 @@ end it 'cannot RSVP as a coach' do - expect(page).not_to have_content('Attend as a coach') + expect(page).to have_no_content('Attend as a coach') end end @@ -44,7 +44,7 @@ end it 'cannot RSVP as a student' do - expect(page).not_to have_content('Attend as a student') + expect(page).to have_no_content('Attend as a student') end end @@ -118,8 +118,8 @@ end it 'cannot access RSVP as a student or coach' do - expect(page).not_to have_content('Attend as a student') - expect(page).not_to have_content('Attend as a coach') + expect(page).to have_no_content('Attend as a student') + expect(page).to have_no_content('Attend as a coach') end end end @@ -161,8 +161,8 @@ visit workshop_path(workshop) expect(page).to have_button('Manage your invitation') - expect(page).not_to have_button('Attend as a student') - expect(page).not_to have_button('Attend as a coach') + expect(page).to have_no_button('Attend as a student') + expect(page).to have_no_button('Attend as a coach') end end @@ -173,7 +173,7 @@ click_on 'Attend as a coach' expect(page).to have_content('This event has already taken place') - expect(page).not_to have_button('Attend as a coach') + expect(page).to have_no_button('Attend as a coach') end end end diff --git a/spec/support/shared_examples/behaves_link_member_viewing_workshop.rb b/spec/support/shared_examples/behaves_link_member_viewing_workshop.rb index df042185d..300abb5a0 100644 --- a/spec/support/shared_examples/behaves_link_member_viewing_workshop.rb +++ b/spec/support/shared_examples/behaves_link_member_viewing_workshop.rb @@ -15,7 +15,7 @@ login(banned_member) visit workshop_path(workshop) - expect(page).to_not have_button("Attend as a #{member_type.downcase}") + expect(page).to have_no_button("Attend as a #{member_type.downcase}") end end end From 5a1119a520cc8b4c6a1d7221e60f1ec60197e751 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 09:06:59 +0200 Subject: [PATCH 7/7] style: Fix Capybara/RSpec/HaveContent offenses Fix 339 offenses and regenerate .rubocop_todo.yml. --- .rubocop_todo.yml | 61 +++------------ spec/components/event_card_component_spec.rb | 2 +- spec/features/accepting_invitation_spec.rb | 14 ++-- .../accepting_terms_and_conditions_spec.rb | 12 +-- spec/features/admin/accessing_portal_spec.rb | 8 +- .../admin/add_user_to_workshop_spec.rb | 2 +- spec/features/admin/announcements_spec.rb | 24 +++--- spec/features/admin/chapter/feedback_spec.rb | 6 +- spec/features/admin/chapters_spec.rb | 26 +++---- spec/features/admin/event_spec.rb | 34 ++++---- spec/features/admin/feedback_spec.rb | 4 +- .../admin/filtering_sponsors_list_spec.rb | 2 +- spec/features/admin/groups_spec.rb | 6 +- spec/features/admin/manage_event_spec.rb | 18 ++--- spec/features/admin/manage_sponsor_spec.rb | 14 ++-- .../admin/manage_workshop_attendances_spec.rb | 16 ++-- .../managing_meeting_invitations_spec.rb | 6 +- .../admin/managing_organisers_spec.rb | 6 +- .../admin/managing_testimonials_spec.rb | 6 +- spec/features/admin/meeting_spec.rb | 14 ++-- spec/features/admin/member_search_spec.rb | 2 +- spec/features/admin/members_spec.rb | 30 +++---- spec/features/admin/sponsor_spec.rb | 78 +++++++++---------- .../admin/tom_select_member_lookup_spec.rb | 6 +- spec/features/admin/workshops_spec.rb | 56 ++++++------- spec/features/chapter_spec.rb | 20 ++--- spec/features/internationalization_spec.rb | 6 +- spec/features/listing_coaches_spec.rb | 2 +- spec/features/listing_events_spec.rb | 10 +-- .../manage_contact_preferences_spec.rb | 4 +- spec/features/member/login_spec.rb | 2 +- spec/features/member_feedback_spec.rb | 12 +-- spec/features/member_joining_spec.rb | 20 ++--- spec/features/member_portal_spec.rb | 18 ++--- spec/features/member_updating_details_spec.rb | 6 +- spec/features/subscribing_to_emails_spec.rb | 4 +- .../subscribing_to_newsletter_spec.rb | 8 +- spec/features/view_event_spec.rb | 22 +++--- spec/features/viewing_a_meeting_spec.rb | 8 +- .../viewing_a_workshop_invitation_spec.rb | 28 +++---- spec/features/viewing_a_workshop_spec.rb | 16 ++-- spec/features/viewing_pages_spec.rb | 6 +- spec/features/visiting_homepage_spec.rb | 20 ++--- .../behaves_like_an_invitation_route.rb | 36 ++++----- ...haves_like_managing_workshop_attendance.rb | 30 +++---- .../behaves_like_viewing_workshop_actions.rb | 4 +- .../behaves_like_viewing_workshop_details.rb | 4 +- 47 files changed, 348 insertions(+), 391 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 103ac53ce..9a8fefd5b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,62 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit` -# on 2026-07-28 07:06:33 UTC using RuboCop version 1.88.2. +# on 2026-07-28 07:06:57 UTC using RuboCop version 1.88.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 339 -# This cop supports safe autocorrection (--autocorrect). -Capybara/RSpec/HaveContent: - Exclude: - - 'spec/components/event_card_component_spec.rb' - - 'spec/features/accepting_invitation_spec.rb' - - 'spec/features/accepting_terms_and_conditions_spec.rb' - - 'spec/features/admin/accessing_portal_spec.rb' - - 'spec/features/admin/add_user_to_workshop_spec.rb' - - 'spec/features/admin/announcements_spec.rb' - - 'spec/features/admin/chapter/feedback_spec.rb' - - 'spec/features/admin/chapters_spec.rb' - - 'spec/features/admin/event_spec.rb' - - 'spec/features/admin/feedback_spec.rb' - - 'spec/features/admin/filtering_sponsors_list_spec.rb' - - 'spec/features/admin/groups_spec.rb' - - 'spec/features/admin/manage_event_spec.rb' - - 'spec/features/admin/manage_sponsor_spec.rb' - - 'spec/features/admin/manage_workshop_attendances_spec.rb' - - 'spec/features/admin/managing_meeting_invitations_spec.rb' - - 'spec/features/admin/managing_organisers_spec.rb' - - 'spec/features/admin/managing_testimonials_spec.rb' - - 'spec/features/admin/meeting_spec.rb' - - 'spec/features/admin/member_search_spec.rb' - - 'spec/features/admin/members_spec.rb' - - 'spec/features/admin/sponsor_spec.rb' - - 'spec/features/admin/tom_select_member_lookup_spec.rb' - - 'spec/features/admin/workshops_spec.rb' - - 'spec/features/chapter_spec.rb' - - 'spec/features/internationalization_spec.rb' - - 'spec/features/listing_coaches_spec.rb' - - 'spec/features/listing_events_spec.rb' - - 'spec/features/manage_contact_preferences_spec.rb' - - 'spec/features/member/login_spec.rb' - - 'spec/features/member_feedback_spec.rb' - - 'spec/features/member_joining_spec.rb' - - 'spec/features/member_portal_spec.rb' - - 'spec/features/member_updating_details_spec.rb' - - 'spec/features/subscribing_to_emails_spec.rb' - - 'spec/features/subscribing_to_newsletter_spec.rb' - - 'spec/features/view_event_spec.rb' - - 'spec/features/viewing_a_meeting_spec.rb' - - 'spec/features/viewing_a_workshop_invitation_spec.rb' - - 'spec/features/viewing_a_workshop_spec.rb' - - 'spec/features/viewing_pages_spec.rb' - - 'spec/features/visiting_homepage_spec.rb' - - 'spec/support/shared_examples/behaves_like_an_invitation_route.rb' - - 'spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb' - - 'spec/support/shared_examples/behaves_like_viewing_workshop_actions.rb' - - 'spec/support/shared_examples/behaves_like_viewing_workshop_details.rb' - # Offense count: 4 Capybara/RSpec/NegationMatcherAfterVisit: Exclude: @@ -69,6 +18,14 @@ Capybara/RSpec/VisibilityMatcher: Exclude: - 'spec/components/chapters_sidebar_component_spec.rb' +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: with_first_argument, with_fixed_indentation +Layout/ArgumentAlignment: + Exclude: + - 'spec/features/member_portal_spec.rb' + # Offense count: 14 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. diff --git a/spec/components/event_card_component_spec.rb b/spec/components/event_card_component_spec.rb index df6e0a5fd..433864037 100644 --- a/spec/components/event_card_component_spec.rb +++ b/spec/components/event_card_component_spec.rb @@ -13,7 +13,7 @@ render_inline(described_class.new(event_card: presenter)) expect(page).to have_css("[data-test='event']") expect(page).to have_link(presenter.to_s) - expect(page).to have_content(presenter.date) + expect(page).to have_text(presenter.date) end it "does not render user-specific badges without a user" do diff --git a/spec/features/accepting_invitation_spec.rb b/spec/features/accepting_invitation_spec.rb index efb0ce851..fb6524946 100644 --- a/spec/features/accepting_invitation_spec.rb +++ b/spec/features/accepting_invitation_spec.rb @@ -28,7 +28,7 @@ visit invitation_route - expect(page).to have_content('The workshop is full') + expect(page).to have_text('The workshop is full') expect(page).to have_button('Join the waiting list') expect(page).to have_no_button('Attend') end @@ -41,7 +41,7 @@ visit invitation_route click_on 'Attend' - expect(page).to have_content('RSVPs for this workshop are now closed.') + expect(page).to have_text('RSVPs for this workshop are now closed.') expect(invitation.reload.attending).not_to be(true) end end @@ -54,7 +54,7 @@ click_on 'Attend' - expect(page).to have_content('Tutorial must be selected') + expect(page).to have_text('Tutorial must be selected') end scenario 'with an accepted invitation can edit the tutorial' do @@ -64,7 +64,7 @@ select tutorial.title, from: :workshop_invitation_tutorial click_on 'Update' - expect(page).to have_content('Invitation details successfully updated.') + expect(page).to have_text('Invitation details successfully updated.') end end @@ -77,7 +77,7 @@ click_on 'Attend' - expect(page).to have_content("Thanks for getting back to us #{member.name}. See you at the workshop!") + expect(page).to have_text("Thanks for getting back to us #{member.name}. See you at the workshop!") expect(page).to have_field('workshop_invitation_note', with: '') end @@ -87,7 +87,7 @@ fill_in 'Note', with: note click_on 'Attend' - expect(page).to have_content("Thanks for getting back to us #{member.name}. See you at the workshop!") + expect(page).to have_text("Thanks for getting back to us #{member.name}. See you at the workshop!") expect(page).to have_field('workshop_invitation_note', with: note) end @@ -102,7 +102,7 @@ click_on 'Update note' expect(page).to have_field('workshop_invitation_note', with: note) - expect(page).to have_content("Invitation details successfully updated.") + expect(page).to have_text("Invitation details successfully updated.") end end end diff --git a/spec/features/accepting_terms_and_conditions_spec.rb b/spec/features/accepting_terms_and_conditions_spec.rb index bf5ae6880..5ce7f6297 100644 --- a/spec/features/accepting_terms_and_conditions_spec.rb +++ b/spec/features/accepting_terms_and_conditions_spec.rb @@ -13,7 +13,7 @@ click_on 'Accept' expect(page).to have_current_path(terms_and_conditions_path) - expect(page).to have_content('You have to accept the Terms and Conditions before you are able to proceed.') + expect(page).to have_text('You have to accept the Terms and Conditions before you are able to proceed.') end scenario 'they can read the Code of Conduct before accepting the ToCs', :js do @@ -26,9 +26,9 @@ # When clicking a link that opens a new window/tab new_window = window_opened_by { click_on I18n.t('terms_and_conditions.link_text') } within_window new_window do - expect(page).to have_content(I18n.t('code_of_conduct.title')) - expect(page).to have_content(I18n.t('code_of_conduct.summary.title')) - expect(page).to have_content(I18n.t('code_of_conduct.content.title')) + expect(page).to have_text(I18n.t('code_of_conduct.title')) + expect(page).to have_text(I18n.t('code_of_conduct.summary.title')) + expect(page).to have_text(I18n.t('code_of_conduct.content.title')) end end @@ -74,7 +74,7 @@ visit terms_and_conditions_path expect(page).to have_current_path(terms_and_conditions_path) - expect(page).to have_content(/already accepted.*#{member.accepted_toc_at.strftime('%d %B %Y')}/) + expect(page).to have_text(/already accepted.*#{member.accepted_toc_at.strftime('%d %B %Y')}/) expect(page).to have_no_button('Accept') end end @@ -84,7 +84,7 @@ scenario 'they see a login prompt and cannot accept the ToCs' do visit terms_and_conditions_path - expect(page).to have_content('Please log in to accept our Code of Conduct.') + expect(page).to have_text('Please log in to accept our Code of Conduct.') expect(page).to have_link('Log in with GitHub') end diff --git a/spec/features/admin/accessing_portal_spec.rb b/spec/features/admin/accessing_portal_spec.rb index a147d1b17..865f9d473 100644 --- a/spec/features/admin/accessing_portal_spec.rb +++ b/spec/features/admin/accessing_portal_spec.rb @@ -20,11 +20,11 @@ visit admin_root_path chapter.groups.each do |group| - expect(page).to have_content(group.to_s) + expect(page).to have_text(group.to_s) end inactive_chapter.groups.each do |group| - expect(page).to have_no_content(group.to_s) + expect(page).to have_no_text(group.to_s) end end @@ -32,8 +32,8 @@ visit admin_root_path click_on 'Sponsor contacts' - expect(page).to have_content('Contacts') - expect(page).to have_content('Sponsor Contact name Contact email Mailing list') + expect(page).to have_text('Contacts') + expect(page).to have_text('Sponsor Contact name Contact email Mailing list') end end end diff --git a/spec/features/admin/add_user_to_workshop_spec.rb b/spec/features/admin/add_user_to_workshop_spec.rb index 73c59f869..9d47f71a1 100644 --- a/spec/features/admin/add_user_to_workshop_spec.rb +++ b/spec/features/admin/add_user_to_workshop_spec.rb @@ -29,7 +29,7 @@ click_on 'Search' expect(page).to have_current_path('/admin/member-search/index', ignore_query: true) - expect(page).to have_content('Romeo Montague') + expect(page).to have_text('Romeo Montague') expect(page).to have_unchecked_field('Romeo Montague') check('Romeo Montague') click_button 'Take me back' diff --git a/spec/features/admin/announcements_spec.rb b/spec/features/admin/announcements_spec.rb index fe31fdbec..154f48511 100644 --- a/spec/features/admin/announcements_spec.rb +++ b/spec/features/admin/announcements_spec.rb @@ -14,7 +14,7 @@ fill_in 'Message', with: 'An announcement' click_on 'announcement[create]' - expect(page).to have_content('Announcement successfully created') + expect(page).to have_text('Announcement successfully created') expect(page).to have_current_path(admin_announcements_path, ignore_query: true) end end @@ -24,7 +24,7 @@ visit new_admin_announcement_path click_on 'announcement[create]' - expect(page).to have_content('Please make sure you fill in all mandatory fields') + expect(page).to have_text('Please make sure you fill in all mandatory fields') end end @@ -35,8 +35,8 @@ fill_in 'Message', with: 'New event coming up soon! Stay tuned.' click_on 'announcement[update]' - expect(page).to have_content('Announcement successfully updated') - expect(page).to have_content('New event coming up soon! Stay tuned.') + expect(page).to have_text('Announcement successfully updated') + expect(page).to have_text('New event coming up soon! Stay tuned.') expect(page).to have_current_path(admin_announcements_path, ignore_query: true) end end @@ -48,8 +48,8 @@ visit admin_announcements_path - expect(page).to have_content(announcement.message) - expect(page).to have_content(old_announcement.message) + expect(page).to have_text(announcement.message) + expect(page).to have_text(old_announcement.message) end end @@ -59,9 +59,9 @@ check 'Send to all groups' click_on 'announcement[create]' - expect(page).to have_content('An announcement to every group') - expect(page).to have_content("Coaches #{chapter.name}") - expect(page).to have_content("Students #{chapter.name}") + expect(page).to have_text('An announcement to every group') + expect(page).to have_text("Coaches #{chapter.name}") + expect(page).to have_text("Students #{chapter.name}") expect(page).to have_current_path(admin_announcements_path, ignore_query: true) end @@ -71,9 +71,9 @@ select "Coaches #{chapter.name}", from: 'Select group' click_on 'announcement[create]' - expect(page).to have_content('An announcement to selected groups') - expect(page).to have_content("Coaches #{chapter.name}") - expect(page).to have_no_content("Students #{chapter.name}") + expect(page).to have_text('An announcement to selected groups') + expect(page).to have_text("Coaches #{chapter.name}") + expect(page).to have_no_text("Students #{chapter.name}") expect(page).to have_current_path(admin_announcements_path, ignore_query: true) end end diff --git a/spec/features/admin/chapter/feedback_spec.rb b/spec/features/admin/chapter/feedback_spec.rb index 746e27d29..1f6113348 100644 --- a/spec/features/admin/chapter/feedback_spec.rb +++ b/spec/features/admin/chapter/feedback_spec.rb @@ -13,8 +13,8 @@ visit root_path click_on "#{chapter.name} feedback" - feedbacks.each { |feedback| expect(page).to have_content(feedback.request) } - other_feedbacks.each { |feedback| expect(page).to have_no_content(feedback.request) } + feedbacks.each { |feedback| expect(page).to have_text(feedback.request) } + other_feedbacks.each { |feedback| expect(page).to have_no_text(feedback.request) } end it 'displays a message if no feedback has been submitted yet' do @@ -25,6 +25,6 @@ visit root_path click_on "#{chapter.name} feedback" - expect(page).to have_content("No feedback has been submitted for #{chapter.name} workshops yet.") + expect(page).to have_text("No feedback has been submitted for #{chapter.name} workshops yet.") end end diff --git a/spec/features/admin/chapters_spec.rb b/spec/features/admin/chapters_spec.rb index 1f6ebcdb4..30d89c9d7 100644 --- a/spec/features/admin/chapters_spec.rb +++ b/spec/features/admin/chapters_spec.rb @@ -8,7 +8,7 @@ visit new_admin_chapter_path expect(page).to have_current_path('/') - expect(page).to have_content "You can't be here" + expect(page).to have_text "You can't be here" end end @@ -26,7 +26,7 @@ click_on 'Create chapter' - expect(page).to have_content('Chapter codebar Brighton has been successfully created') + expect(page).to have_text('Chapter codebar Brighton has been successfully created') end end @@ -49,7 +49,7 @@ click_on 'Update chapter' - expect(page).to have_content('Chapter codebar Brighton has been successfully updated') + expect(page).to have_text('Chapter codebar Brighton has been successfully updated') end end @@ -64,7 +64,7 @@ visit edit_admin_chapter_path(chapter) expect(page).to have_current_path('/') - expect(page).to have_content('You are not authorized to perform this action.') + expect(page).to have_text('You are not authorized to perform this action.') end end @@ -84,7 +84,7 @@ click_on 'Update chapter' - expect(page).to have_content('Chapter codebar Brighton has been successfully updated') + expect(page).to have_text('Chapter codebar Brighton has been successfully updated') end end end @@ -102,7 +102,7 @@ members_emails = chapter.members.map(&:email) members_emails.each do |email| - expect(page).to have_content(email) + expect(page).to have_text(email) end end @@ -113,10 +113,10 @@ coach_email = chapter.coaches.first.email students_emails.each do |email| - expect(page).to have_content(email) + expect(page).to have_text(email) end - expect(page).to have_no_content(coach_email) + expect(page).to have_no_text(coach_email) end end @@ -134,15 +134,15 @@ visit admin_chapter_path(chapter) - expect(page).to have_content('How members found this chapter') - expect(page).to have_content('Based on 1 response') + expect(page).to have_text('How members found this chapter') + expect(page).to have_text('Based on 1 response') end scenario 'does not show the card when there are no responses' do visit admin_chapter_path(chapter) expect(page).to have_css('body') - expect(page).to have_no_content('How members found this chapter') + expect(page).to have_no_text('How members found this chapter') end end @@ -156,8 +156,8 @@ scenario 'shows explanation for eligible members' do visit admin_chapter_path(chapter) - expect(page).to have_content('What is "eligible"?') - expect(page).to have_content(/Are not banned/i) + expect(page).to have_text('What is "eligible"?') + expect(page).to have_text(/Are not banned/i) end end end diff --git a/spec/features/admin/event_spec.rb b/spec/features/admin/event_spec.rb index 1154c51bb..a88a0e87f 100644 --- a/spec/features/admin/event_spec.rb +++ b/spec/features/admin/event_spec.rb @@ -27,18 +27,18 @@ select sponsor.name, from: 'Venue' click_on 'Save' - expect(page).to have_content('Event successfully created') + expect(page).to have_text('Event successfully created') - expect(page).to have_content('A test event') - expect(page).to have_content(humanize_date(date)) - expect(page).to have_content('A test event description') - expect(page).to have_content('25 student spots, 19 coach spots') - expect(page).to have_content('9:00 Sign up & breakfast 9:30 kick off') + expect(page).to have_text('A test event') + expect(page).to have_text(humanize_date(date)) + expect(page).to have_text('A test event description') + expect(page).to have_text('25 student spots, 19 coach spots') + expect(page).to have_text('9:00 Sign up & breakfast 9:30 kick off') within '#host' do - expect(page).to have_content sponsor.name - expect(page).to have_content sponsor.address.street - expect(page).to have_content sponsor.address.city + expect(page).to have_text sponsor.name + expect(page).to have_text sponsor.address.street + expect(page).to have_text sponsor.address.city end end end @@ -62,16 +62,16 @@ check 'This is a virtual event' click_on 'Save' - expect(page).to have_content('Event successfully created') + expect(page).to have_text('Event successfully created') - expect(page).to have_content('A test virtual event') - expect(page).to have_content(humanize_date(date)) - expect(page).to have_content('A test virtual event description') - expect(page).to have_content('25 student spots, 19 coach spots') - expect(page).to have_content('9:00 Sign up & breakfast 9:30 kick off') + expect(page).to have_text('A test virtual event') + expect(page).to have_text(humanize_date(date)) + expect(page).to have_text('A test virtual event description') + expect(page).to have_text('25 student spots, 19 coach spots') + expect(page).to have_text('9:00 Sign up & breakfast 9:30 kick off') within '#host' do - expect(page).to have_content('This is a virtual event.') + expect(page).to have_text('This is a virtual event.') end end end @@ -82,7 +82,7 @@ click_on 'Save' - expect(page).to have_content('Make sure you fill in all mandatory fields') + expect(page).to have_text('Make sure you fill in all mandatory fields') end end end diff --git a/spec/features/admin/feedback_spec.rb b/spec/features/admin/feedback_spec.rb index 96f8bfd0e..4b5d5705a 100644 --- a/spec/features/admin/feedback_spec.rb +++ b/spec/features/admin/feedback_spec.rb @@ -10,7 +10,7 @@ feedbacks = Fabricate.times(2, :feedback) visit admin_feedback_index_path - feedbacks.each { |feedback| expect(page).to have_content(feedback.request) } + feedbacks.each { |feedback| expect(page).to have_text(feedback.request) } end end @@ -22,7 +22,7 @@ it 'can not access the feedback page' do visit admin_feedback_index_path - expect(page).to have_content('You can\'t be here') + expect(page).to have_text('You can\'t be here') end end end diff --git a/spec/features/admin/filtering_sponsors_list_spec.rb b/spec/features/admin/filtering_sponsors_list_spec.rb index 17fbcd671..6c88598c3 100644 --- a/spec/features/admin/filtering_sponsors_list_spec.rb +++ b/spec/features/admin/filtering_sponsors_list_spec.rb @@ -22,7 +22,7 @@ click_on 'Filter' expect(page).to have_css('.sponsor', count: 1) - expect(page).to have_content(sponsors.first.name) + expect(page).to have_text(sponsors.first.name) end end end diff --git a/spec/features/admin/groups_spec.rb b/spec/features/admin/groups_spec.rb index bf6b8ee2e..e2aab61d1 100644 --- a/spec/features/admin/groups_spec.rb +++ b/spec/features/admin/groups_spec.rb @@ -14,7 +14,7 @@ select 'Brighton', from: 'group[chapter_id]' click_on 'Create group' - expect(page).to have_content('Group Students for chapter Brighton has been successfully created') + expect(page).to have_text('Group Students for chapter Brighton has been successfully created') end end @@ -30,8 +30,8 @@ scenario 'shows explanation for eligible members' do visit admin_group_path(group) - expect(page).to have_content('What is "eligible"?') - expect(page).to have_content(/Are not banned/i) + expect(page).to have_text('What is "eligible"?') + expect(page).to have_text(/Are not banned/i) end end end diff --git a/spec/features/admin/manage_event_spec.rb b/spec/features/admin/manage_event_spec.rb index 93fcde90e..cd0c77042 100644 --- a/spec/features/admin/manage_event_spec.rb +++ b/spec/features/admin/manage_event_spec.rb @@ -11,10 +11,10 @@ scenario 'accessing an event' do visit admin_event_path(event) - expect(page).to have_content(event.name) + expect(page).to have_text(event.name) - expect(page).to have_content 'Venue' - expect(page).to have_content event.venue.name + expect(page).to have_text 'Venue' + expect(page).to have_text event.venue.name end scenario 'verifying an attendance' do @@ -23,7 +23,7 @@ click_on 'Verify' - expect(page).to have_content "You have verified #{invitation.member.full_name}'s spot at the event!" + expect(page).to have_text "You have verified #{invitation.member.full_name}'s spot at the event!" expect(invitation.reload.verified_by).to eq(member) end @@ -33,7 +33,7 @@ click_on 'Cancel' - expect(page).to have_content "You have cancelled #{invitation.member.full_name}'s attendance." + expect(page).to have_text "You have cancelled #{invitation.member.full_name}'s attendance." expect(invitation.reload.attending).to eq(false) end @@ -44,9 +44,9 @@ click_on 'Emails' - expect(page).to have_content('COACHES') - expect(page).to have_content(coach_invitation.member.email) - expect(page).to have_content('STUDENTS') - expect(page).to have_content(student_invitation.member.email) + expect(page).to have_text('COACHES') + expect(page).to have_text(coach_invitation.member.email) + expect(page).to have_text('STUDENTS') + expect(page).to have_text(student_invitation.member.email) end end diff --git a/spec/features/admin/manage_sponsor_spec.rb b/spec/features/admin/manage_sponsor_spec.rb index 782580f4f..e642f601f 100644 --- a/spec/features/admin/manage_sponsor_spec.rb +++ b/spec/features/admin/manage_sponsor_spec.rb @@ -21,7 +21,7 @@ click_on 'Create sponsor' - expect(page).to have_content 'Sponsor Sponsor name created' + expect(page).to have_text 'Sponsor Sponsor name created' end end @@ -37,7 +37,7 @@ click_on 'Create sponsor' - expect(page).to have_content 'Name can\'t be blank' + expect(page).to have_text 'Name can\'t be blank' end end @@ -73,9 +73,9 @@ click_on 'Save changes' - expect(page).to have_content 'This venue is fully accessible to wheelchair users.' - expect(page).to have_content 'This sponsor has great WiFi.' - expect(page).to have_content 'Office is located on the third floor.' + expect(page).to have_text 'This venue is fully accessible to wheelchair users.' + expect(page).to have_text 'This sponsor has great WiFi.' + expect(page).to have_text 'Office is located on the third floor.' end end @@ -107,8 +107,8 @@ click_on 'Save changes' within '#contacts' do - expect(page).to have_content 'Jane Doe' - expect(page).to have_content 'Main contact - Office manager' + expect(page).to have_text 'Jane Doe' + expect(page).to have_text 'Main contact - Office manager' end end end diff --git a/spec/features/admin/manage_workshop_attendances_spec.rb b/spec/features/admin/manage_workshop_attendances_spec.rb index 9072aa1b0..d4869cffb 100644 --- a/spec/features/admin/manage_workshop_attendances_spec.rb +++ b/spec/features/admin/manage_workshop_attendances_spec.rb @@ -48,7 +48,7 @@ expect(page).to have_css('.cancel_attendance', wait: 5) find('.cancel_attendance').click - expect(page).to have_content('0 are attending as students') + expect(page).to have_text('0 are attending as students') end scenario 'can move a member from the waiting list to the attendee list' do @@ -58,8 +58,8 @@ visit admin_workshop_path(workshop) find('.waiting_list').click - expect(page).to have_content('2 are attending as students') - expect(page).to have_content(I18n.l(other_invitation.reload.rsvp_time)) + expect(page).to have_text('2 are attending as students') + expect(page).to have_text(I18n.l(other_invitation.reload.rsvp_time)) expect(page).to have_css('i.fa-hat-wizard') end @@ -69,15 +69,15 @@ other_invitation = Fabricate(:workshop_invitation, workshop: workshop, attending: nil) visit admin_workshop_path(workshop) - expect(page).to have_content('1 are attending as students') + expect(page).to have_text('1 are attending as students') expect(page).to have_no_css('i.fa-magic') # Use the select_from_chosen helper to select the member select_from_chosen("#{other_invitation.member.full_name} (#{other_invitation.role})", from: 'workshop_invitations') - expect(page).to have_content('2 are attending as students', wait: 5) + expect(page).to have_text('2 are attending as students', wait: 5) - expect(page).to have_content(I18n.l(other_invitation.reload.rsvp_time)) + expect(page).to have_text(I18n.l(other_invitation.reload.rsvp_time)) expect(page).to have_css('.fa-hat-wizard') end @@ -86,8 +86,8 @@ login_as_admin(member) visit admin_workshop_path(workshop) - expect(page).to have_content(invitation.note) - expect(page).to have_content(invitation.tutorial) + expect(page).to have_text(invitation.note) + expect(page).to have_text(invitation.tutorial) end context '#changes' do diff --git a/spec/features/admin/managing_meeting_invitations_spec.rb b/spec/features/admin/managing_meeting_invitations_spec.rb index 9c6342f62..115ec4c3f 100644 --- a/spec/features/admin/managing_meeting_invitations_spec.rb +++ b/spec/features/admin/managing_meeting_invitations_spec.rb @@ -17,7 +17,7 @@ select_from_tom_select(member.full_name, from: 'meeting_invitations_member') click_on 'Add' - expect(page).to have_content("#{member.full_name} has been successfully added and notified via email") + expect(page).to have_text("#{member.full_name} has been successfully added and notified via email") end scenario 'for a member that is already attending', :js do @@ -31,7 +31,7 @@ select_from_tom_select(attending_member.full_name, from: 'meeting_invitations_member') click_on 'Add' - expect(page).to have_content("#{attending_member.full_name} is already on the list!") + expect(page).to have_text("#{attending_member.full_name} is already on the list!") end end @@ -42,6 +42,6 @@ visit admin_meeting_path(meeting) find('.verify-attendance').click - expect(page).to have_content('Updated attendance') + expect(page).to have_text('Updated attendance') end end diff --git a/spec/features/admin/managing_organisers_spec.rb b/spec/features/admin/managing_organisers_spec.rb index 79da8e6ff..4c7e0546f 100644 --- a/spec/features/admin/managing_organisers_spec.rb +++ b/spec/features/admin/managing_organisers_spec.rb @@ -21,7 +21,7 @@ visit admin_chapter_organisers_path(chapter) chapter.organisers.each do |organiser| - expect(page).to have_content(organiser.full_name) + expect(page).to have_text(organiser.full_name) end end @@ -35,7 +35,7 @@ click_on 'Add organiser' within '.organisers' do - expect(page).to have_content(chapter_subscriber.full_name) + expect(page).to have_text(chapter_subscriber.full_name) end end @@ -46,7 +46,7 @@ click_on 'Remove' within '.organisers' do - expect(page).to have_no_content(organiser_name) + expect(page).to have_no_text(organiser_name) end end end diff --git a/spec/features/admin/managing_testimonials_spec.rb b/spec/features/admin/managing_testimonials_spec.rb index 5efdb8ad0..f46ca4778 100644 --- a/spec/features/admin/managing_testimonials_spec.rb +++ b/spec/features/admin/managing_testimonials_spec.rb @@ -6,7 +6,7 @@ visit admin_testimonials_path expect(current_url).to eq(root_url) - expect(page).to have_content("You can't be here") + expect(page).to have_text("You can't be here") end context 'an admin member' do @@ -19,8 +19,8 @@ visit admin_testimonials_path - expect(page).to have_content('Testimonials') - expect(page).to have_content(testimonial.text) + expect(page).to have_text('Testimonials') + expect(page).to have_text(testimonial.text) end end end diff --git a/spec/features/admin/meeting_spec.rb b/spec/features/admin/meeting_spec.rb index f8a2c31fb..4f23041f1 100644 --- a/spec/features/admin/meeting_spec.rb +++ b/spec/features/admin/meeting_spec.rb @@ -20,10 +20,10 @@ select venue.name click_on 'Save' - expect(page).to have_content('Meeting successfully created') + expect(page).to have_text('Meeting successfully created') expect(page) .to have_current_path(admin_meeting_path("#{I18n.l(today, format: :year_month).downcase}-august-meeting-1"), ignore_query: true) - expect(page).to have_content 'Invite' + expect(page).to have_text 'Invite' end scenario 'renders an error when no chapter has been selected' do @@ -31,7 +31,7 @@ click_on 'Save' - expect(page).to have_content('Venue must be set') + expect(page).to have_text('Venue must be set') end end @@ -45,7 +45,7 @@ click_on 'Save' - expect(page).to have_content('Slug has already been taken') + expect(page).to have_text('Slug has already been taken') end scenario 'successfully', :js do @@ -57,7 +57,7 @@ click_on 'Save' - expect(page).to have_content('You have successfully updated the details of this meeting') + expect(page).to have_text('You have successfully updated the details of this meeting') expect(page).to have_css(%(span[title="#{permissions.members.last.full_name}"])) expect(page).to have_no_css(%(span[title="#{permissions.members.first.full_name}"])) end @@ -83,7 +83,7 @@ visit attendees_emails_admin_meeting_path(meeting, format: :text) invitations.each do |invitation| - expect(page).to have_content(invitation.member.email) + expect(page).to have_text(invitation.member.email) end end @@ -100,7 +100,7 @@ meeting = Fabricate(:meeting, chapters: [chapter]) visit invite_admin_meeting_path(meeting) - expect(page).to have_content('Invitations are being sent out') + expect(page).to have_text('Invitations are being sent out') end scenario 'does not send the invitations to banned members' do diff --git a/spec/features/admin/member_search_spec.rb b/spec/features/admin/member_search_spec.rb index 6d7c72403..919ee2bb1 100644 --- a/spec/features/admin/member_search_spec.rb +++ b/spec/features/admin/member_search_spec.rb @@ -11,7 +11,7 @@ expect(page).to have_current_path(results_admin_member_search_index_path, ignore_query: true) - expect(page).to have_content('Juliet Capulet') + expect(page).to have_text('Juliet Capulet') end end diff --git a/spec/features/admin/members_spec.rb b/spec/features/admin/members_spec.rb index fe5cef4a6..fb9102fd1 100644 --- a/spec/features/admin/members_spec.rb +++ b/spec/features/admin/members_spec.rb @@ -15,9 +15,9 @@ describe 'Admin managing members' do it 'can view member information' do - expect(page).to have_content(member.name) - expect(page).to have_content(member.email) - expect(page).to have_content(member.about_you) + expect(page).to have_text(member.name) + expect(page).to have_text(member.email) + expect(page).to have_text(member.about_you) expect(page).to have_css('.badge', text: 'Vegan') expect(page).to have_css('.badge', text: 'Peanut allergy') @@ -25,15 +25,15 @@ it 'can view a summary of member event attendances' do within '.attendance-summary' do - expect(page).to have_content('1 workshops', normalize_ws: true) + expect(page).to have_text('1 workshops', normalize_ws: true) end end it 'can view paginated list of past RSVPs' do click_on 'View all RSVPS' - expect(page).to have_content('Past RSVPs') - expect(page).to have_content('Displaying 1 event') + expect(page).to have_text('Past RSVPs') + expect(page).to have_text('Displaying 1 event') end it 'can add a note about a member' do @@ -42,8 +42,8 @@ click_on 'Save' within '.note' do - expect(page).to have_content 'Bananas and custard' - expect(page).to have_content "Note added by #{admin.full_name}" + expect(page).to have_text 'Bananas and custard' + expect(page).to have_text "Note added by #{admin.full_name}" end end @@ -55,9 +55,9 @@ fill_in 'ban_expires_at', with: Time.zone.today + 1.month click_on 'Suspend member' - expect(page).to have_content 'Member marked as supended and suspension email sent.' + expect(page).to have_text 'Member marked as supended and suspension email sent.' within '.suspension' do - expect(page).to have_content "Suspended until #{I18n.l(Time.zone.today + 1.month)} by #{admin.full_name}" + expect(page).to have_text "Suspended until #{I18n.l(Time.zone.today + 1.month)} by #{admin.full_name}" end end @@ -68,15 +68,15 @@ end.to change { member.subscriptions.count }.by(-1) end - expect(page).to have_content "Successfully unsubscribed #{member.full_name}" + expect(page).to have_text "Successfully unsubscribed #{member.full_name}" end it 'can send an eligibility email to a member' do click_on 'Send eligibility inquiry' - expect(page).to have_content 'Eligibility inquiry email sent.' + expect(page).to have_text 'Eligibility inquiry email sent.' within '.eligibility-inquiry' do - expect(page).to have_content "Sent eligibility inquiry email by #{admin.full_name}" + expect(page).to have_text "Sent eligibility inquiry email by #{admin.full_name}" end end @@ -85,9 +85,9 @@ click_on 'Send attendance warning' expect(page).to have_css("a[data-confirm='#{member.name} has already received a warning about missing too many workshops on #{member.attendance_warnings.last.created_at.strftime('%Y-%m-%d at %H:%M')}. Are you sure you want to proceed with sending another one?']") - expect(page).to have_content 'Attendance warning email sent.' + expect(page).to have_text 'Attendance warning email sent.' within '.attendance-warning' do - expect(page).to have_content "Sent attendance warning email by #{admin.full_name}" + expect(page).to have_text "Sent attendance warning email by #{admin.full_name}" end end end diff --git a/spec/features/admin/sponsor_spec.rb b/spec/features/admin/sponsor_spec.rb index e65fe5864..7349e597d 100644 --- a/spec/features/admin/sponsor_spec.rb +++ b/spec/features/admin/sponsor_spec.rb @@ -15,13 +15,13 @@ visit admin_sponsors_path - expect(page).to have_content(sponsor.name) - expect(page).to have_content(sponsor2.name) + expect(page).to have_text(sponsor.name) + expect(page).to have_text(sponsor2.name) expect(page.all(:css, 'tbody tr', count: 2)) - expect(page).to have_content(hosted_workshop.chapter.name) - expect(page).to have_content(sponsored_workshop.chapter.name) + expect(page).to have_text(hosted_workshop.chapter.name) + expect(page).to have_text(sponsored_workshop.chapter.name) select sponsored_workshop.chapter.name, from: 'sponsors_search[chapter]' click_on 'Filter' @@ -40,8 +40,8 @@ visit admin_sponsors_path - expect(page).to have_content(sponsor.name) - expect(page).to have_content(sponsor2.name) + expect(page).to have_text(sponsor.name) + expect(page).to have_text(sponsor2.name) expect(page.all(:css, 'tbody tr', count: 2)) @@ -58,7 +58,7 @@ click_on 'Filter' expect(page.all(:css, 'tbody tr', count: 0)) - expect(page).to have_content('No sponsor found') + expect(page).to have_text('No sponsor found') end scenario 'can clear filtering form' do @@ -67,13 +67,13 @@ visit admin_sponsors_path - expect(page).to have_content(sponsor.name) - expect(page).to have_content(sponsor2.name) + expect(page).to have_text(sponsor.name) + expect(page).to have_text(sponsor2.name) expect(page.all(:css, 'tbody tr', count: 2)) - expect(page).to have_content(hosted_workshop.chapter.name) - expect(page).to have_content(sponsored_workshop.chapter.name) + expect(page).to have_text(hosted_workshop.chapter.name) + expect(page).to have_text(sponsored_workshop.chapter.name) select sponsored_workshop.chapter.name, from: 'sponsors_search[chapter]' click_on 'Filter' @@ -93,25 +93,25 @@ end scenario 'displays all sponsor details' do - expect(page).to have_content(sponsor.name) - expect(page).to have_content(sponsor.description) + expect(page).to have_text(sponsor.name) + expect(page).to have_text(sponsor.description) expect(page).to have_link(sponsor.website, href: sponsor.website) - expect(page).to have_content(sponsor.level) - expect(page).to have_content(ContactPresenter.new(sponsor.contacts.first).full_name) + expect(page).to have_text(sponsor.level) + expect(page).to have_text(ContactPresenter.new(sponsor.contacts.first).full_name) - expect(page).to have_content(sponsor.seats) - expect(page).to have_content(sponsor.coach_spots) - expect(page).to have_content(sponsor.accessibility_info) - expect(page).to have_content(sponsor.address.street) + expect(page).to have_text(sponsor.seats) + expect(page).to have_text(sponsor.coach_spots) + expect(page).to have_text(sponsor.accessibility_info) + expect(page).to have_text(sponsor.address.street) end context 'sponsorships' do scenario 'when no sponsorships' do within '#sponsorships' do - expect(page).to have_content('No sponsorships') - expect(page).to have_no_content('Workshops') - expect(page).to have_no_content('Events') - expect(page).to have_no_content('Meetings') + expect(page).to have_text('No sponsorships') + expect(page).to have_no_text('Workshops') + expect(page).to have_no_text('Events') + expect(page).to have_no_text('Meetings') end end @@ -121,9 +121,9 @@ visit admin_sponsor_path(sponsor) within '#sponsorships' do - expect(page).to have_content('Workshops') - expect(page).to have_content("#{sponsored_workshop.chapter.name}") - expect(page).to have_content("#{hosted_workshop.chapter.name} (host)") + expect(page).to have_text('Workshops') + expect(page).to have_text("#{sponsored_workshop.chapter.name}") + expect(page).to have_text("#{hosted_workshop.chapter.name} (host)") end end @@ -135,10 +135,10 @@ visit admin_sponsor_path(sponsor) within '#sponsorships' do - expect(page).to have_content('Events') - expect(page).to have_content("#{gold_event.to_s} - GOLD") - expect(page).to have_content("#{silver_event} - SILVER") - expect(page).to have_content("#{standard_event} - Standard") + expect(page).to have_text('Events') + expect(page).to have_text("#{gold_event.to_s} - GOLD") + expect(page).to have_text("#{silver_event} - SILVER") + expect(page).to have_text("#{standard_event} - Standard") end end @@ -148,8 +148,8 @@ visit admin_sponsor_path(sponsor) within '#sponsorships' do - expect(page).to have_content('Meetings') - expect(page).to have_content(meeting.title) + expect(page).to have_text('Meetings') + expect(page).to have_text(meeting.title) end end end @@ -163,7 +163,7 @@ visit admin_sponsor_path(sponsor) within '#activities' do - expect(page).to have_content("#{manager.full_name} subscribed #{contact.name} #{contact.surname} with email #{contact.email} to the Sponsor newsletter") + expect(page).to have_text("#{manager.full_name} subscribed #{contact.name} #{contact.surname} with email #{contact.email} to the Sponsor newsletter") end end @@ -177,7 +177,7 @@ visit admin_sponsor_path(sponsor) within '#activities' do - expect(page).to have_no_content("#{manager.full_name} subscribed #{contact.name} #{contact.surname} with email #{contact.email} to the Sponsor newsletter") + expect(page).to have_no_text("#{manager.full_name} subscribed #{contact.name} #{contact.surname} with email #{contact.email} to the Sponsor newsletter") end end end @@ -208,7 +208,7 @@ check 'sponsor_contacts_attributes_0_mailing_list_consent' click_on 'Save changes' - expect(page).to have_content("#{manager.full_name} subscribed Jane Doe with email jane@codebar.io to the Sponsor newsletter") + expect(page).to have_text("#{manager.full_name} subscribed Jane Doe with email jane@codebar.io to the Sponsor newsletter") end it 'can unsubscribe a contact to the sponsor newsletter', wip: true do @@ -218,7 +218,7 @@ uncheck 'sponsor_contacts_attributes_0_mailing_list_consent' click_on 'Save changes' - expect(page).to have_content("#{manager.full_name} unsubscribed #{contact.name} #{contact.surname} with email #{contact.email} from the Sponsor newsletter") + expect(page).to have_text("#{manager.full_name} unsubscribed #{contact.name} #{contact.surname} with email #{contact.email} from the Sponsor newsletter") end end @@ -229,9 +229,9 @@ scenario 'displays all sponsor contacts' do visit admin_contacts_path - expect(page).to have_content(sponsor.name) - expect(page).to have_content(sponsor.contacts.first.name) - expect(page).to have_no_content(sponsor_no_contacts.name) + expect(page).to have_text(sponsor.name) + expect(page).to have_text(sponsor.contacts.first.name) + expect(page).to have_no_text(sponsor_no_contacts.name) end end end diff --git a/spec/features/admin/tom_select_member_lookup_spec.rb b/spec/features/admin/tom_select_member_lookup_spec.rb index a011fff49..eeb612609 100644 --- a/spec/features/admin/tom_select_member_lookup_spec.rb +++ b/spec/features/admin/tom_select_member_lookup_spec.rb @@ -22,10 +22,10 @@ expect(page).to have_css('.ts-dropdown .option', wait: 15) - expect(page).to have_content('Jane Doe') - expect(page).to have_content('jane@example.com') + expect(page).to have_text('Jane Doe') + expect(page).to have_text('jane@example.com') - expect(page).to have_no_content('John Smith') + expect(page).to have_no_text('John Smith') end scenario 'selecting a member updates view profile link' do diff --git a/spec/features/admin/workshops_spec.rb b/spec/features/admin/workshops_spec.rb index 928872100..881b59152 100644 --- a/spec/features/admin/workshops_spec.rb +++ b/spec/features/admin/workshops_spec.rb @@ -14,7 +14,7 @@ visit admin_chapter_workshops_path(chapter) workshops.each do |workshop| - expect(page).to have_content(humanize_date(workshop.date_and_time, with_time: true, with_year: true)) + expect(page).to have_text(humanize_date(workshop.date_and_time, with_time: true, with_year: true)) end end @@ -26,13 +26,13 @@ end scenario 'displays details specific to a virtual workshop' do - expect(page).to have_content('Virtual workshop details') - expect(page).to have_content("Slack channel: ##{workshop.slack_channel}") - expect(page).to have_content('codebar Discord') + expect(page).to have_text('Virtual workshop details') + expect(page).to have_text("Slack channel: ##{workshop.slack_channel}") + expect(page).to have_text('codebar Discord') end scenario 'displays the available student coach workshop spots' do - expect(page).to have_content("#{workshop.student_spaces} student spots, #{workshop.coach_spaces} coach spots") + expect(page).to have_text("#{workshop.student_spaces} student spots, #{workshop.coach_spaces} coach spots") end end end @@ -59,9 +59,9 @@ click_on 'Save' - expect(page).to have_content('Workshop successfully created') - expect(page).to have_content '11:30 - 12:45 GMT (GMT+00:00)' - expect(page).to have_content 'Invite' + expect(page).to have_text('Workshop successfully created') + expect(page).to have_text '11:30 - 12:45 GMT (GMT+00:00)' + expect(page).to have_text 'Invite' end scenario 'must have a chapter set' do @@ -76,7 +76,7 @@ click_on 'Save' - expect(page).to have_content('Chapter can\'t be blank') + expect(page).to have_text('Chapter can\'t be blank') end scenario 'must have a host set' do @@ -88,7 +88,7 @@ click_on 'Save' - expect(page).to have_content("Host can't be blank") + expect(page).to have_text("Host can't be blank") end scenario 'can have sponsors assigned' do @@ -100,7 +100,7 @@ click_on 'Save' within '#sponsors' do - expect(page).to have_content sponsor.name + expect(page).to have_text sponsor.name end end @@ -119,8 +119,8 @@ click_on 'Save' - expect(page).to have_content('Workshop successfully created') - expect(page).to have_content '18:30 - 20:45 CET (GMT+01:00)' + expect(page).to have_text('Workshop successfully created') + expect(page).to have_text '18:30 - 20:45 CET (GMT+01:00)' end end @@ -136,10 +136,10 @@ click_on 'Save' - expect(page).to have_content("Slack channel can't be blank") - expect(page).to have_content("Slack channel link can't be blank") - expect(page).to have_content('Student spaces must be greater than 0') - expect(page).to have_content('Coach spaces must be greater than 0') + expect(page).to have_text("Slack channel can't be blank") + expect(page).to have_text("Slack channel link can't be blank") + expect(page).to have_text('Student spaces must be greater than 0') + expect(page).to have_text('Coach spaces must be greater than 0') end scenario 'does not require a host to be set' do @@ -158,8 +158,8 @@ click_on 'Save' - expect(page).to have_content('Workshop successfully created') - expect(page).to have_content 'Invite' + expect(page).to have_text('Workshop successfully created') + expect(page).to have_text 'Invite' end end end @@ -188,7 +188,7 @@ visit admin_workshop_send_invites_path(workshop) click_on 'Students' - expect(page).to have_content('Invitations to students are being emailed out') + expect(page).to have_text('Invitations to students are being emailed out') end scenario 'for a virtual workshop' do @@ -198,7 +198,7 @@ visit admin_workshop_send_invites_path(workshop) click_on 'Students' - expect(page).to have_content('Invitations to students are being emailed out') + expect(page).to have_text('Invitations to students are being emailed out') end end @@ -209,7 +209,7 @@ visit admin_workshop_attendees_emails_path(workshop, format: :text) attendees_emails.each do |email| - expect(page).to have_content(email) + expect(page).to have_text(email) end end @@ -219,7 +219,7 @@ attendees = Fabricate.times(2, :attending_workshop_invitation, workshop: workshop) visit admin_workshop_attendees_checklist_path(workshop, format: :text) attendees.map(&:member).map(&:full_name).each do |name| - expect(page).to have_content(name) + expect(page).to have_text(name) end end @@ -228,7 +228,7 @@ visit admin_workshop_attendees_checklist_path(workshop) expect(page).to have_current_path(admin_workshop_path(workshop), ignore_query: true) - expect(page).to have_content('The requested format is invalid: text/html') + expect(page).to have_text('The requested format is invalid: text/html') end end @@ -239,8 +239,8 @@ click_on 'Pairing CSV' expect(page).to have_current_path(admin_workshop_path(workshop, format: 'csv'), ignore_query: true) - expect(page).to have_content(WorkshopPresenter::PAIRING_HEADINGS.join(',')) - expect(page).to have_no_content('ORGANISER') + expect(page).to have_text(WorkshopPresenter::PAIRING_HEADINGS.join(',')) + expect(page).to have_no_text('ORGANISER') end end @@ -255,8 +255,8 @@ click_on 'Labels' expect(page).to have_current_path(admin_workshop_path(workshop, format: 'csv'), ignore_query: true) - expect(page).to have_content('ORGANISER') - expect(page).to have_no_content(WorkshopPresenter::PAIRING_HEADINGS.join(',')) + expect(page).to have_text('ORGANISER') + expect(page).to have_no_text(WorkshopPresenter::PAIRING_HEADINGS.join(',')) end end end diff --git a/spec/features/chapter_spec.rb b/spec/features/chapter_spec.rb index fd2661b4e..6eba4fa14 100644 --- a/spec/features/chapter_spec.rb +++ b/spec/features/chapter_spec.rb @@ -5,7 +5,7 @@ it 'a visitor to the website cannot access non active chapters' do visit chapter_path(inactive_chapter.slug) - expect(page).to have_content('Page not found') + expect(page).to have_text('Page not found') end it 'a visitor to the website can access inactive chapter events' do @@ -14,7 +14,7 @@ visit workshop_path(past_workshop) - expect(page).to have_content "Workshop at #{past_workshop.host.name}" + expect(page).to have_text "Workshop at #{past_workshop.host.name}" end end end @@ -23,7 +23,7 @@ it 'a visitor to the website cannot access non existing chapter pages' do visit chapter_path('test') - expect(page).to have_content('Page not found') + expect(page).to have_text('Page not found') end it 'renders chapter without organisers' do @@ -32,8 +32,8 @@ visit chapter_path(chapter.slug) - expect(page).to have_content 'Empty Chapter' - expect(page).to have_no_content 'Team' + expect(page).to have_text 'Empty Chapter' + expect(page).to have_no_text 'Team' end it 'renders any upcoming workshops for the chapter' do @@ -45,7 +45,7 @@ visit chapter_path(chapter.slug) workshops.each do |workshop| - expect(page).to have_content "Workshop at #{workshop.host.name}" + expect(page).to have_text "Workshop at #{workshop.host.name}" end end end @@ -60,8 +60,8 @@ end visit chapter_path(chapter.slug) - expect(page).to have_content 'Event 1' - expect(page).to have_content 'Event 2' + expect(page).to have_text 'Event 1' + expect(page).to have_text 'Event 2' end end @@ -72,8 +72,8 @@ recent_past_workshop = Fabricate(:workshop, chapter: chapter, date_and_time: 1.week.ago) visit chapter_path(chapter.slug) - expect(page).to have_content "Workshop at #{recent_past_workshop.host.name}" - expect(page).to have_no_content "Workshop at #{past_workshop.host.name}" + expect(page).to have_text "Workshop at #{recent_past_workshop.host.name}" + expect(page).to have_no_text "Workshop at #{past_workshop.host.name}" end end diff --git a/spec/features/internationalization_spec.rb b/spec/features/internationalization_spec.rb index cd522fe70..74d8f3eb2 100644 --- a/spec/features/internationalization_spec.rb +++ b/spec/features/internationalization_spec.rb @@ -8,7 +8,7 @@ scenario 'by default' do visit code_of_conduct_path - expect(page).to have_content('Our events are dedicated to providing a harassment-free experience for everyone') + expect(page).to have_text('Our events are dedicated to providing a harassment-free experience for everyone') end end @@ -17,7 +17,7 @@ visit root_path(locale: 'fr') visit code_of_conduct_path - expect(page).to have_content('Nous nous engageons à fournir une expérience bienveillante et dépourvue de harcèlement pour tout le monde') + expect(page).to have_text('Nous nous engageons à fournir une expérience bienveillante et dépourvue de harcèlement pour tout le monde') end end @@ -25,7 +25,7 @@ scenario 'by setting `locale=it`' do visit code_of_conduct_path(locale: 'it') - expect(page).to have_content('Our events are dedicated to providing a harassment-free experience for everyone') + expect(page).to have_text('Our events are dedicated to providing a harassment-free experience for everyone') end end end diff --git a/spec/features/listing_coaches_spec.rb b/spec/features/listing_coaches_spec.rb index cf94e1382..86b772cbb 100644 --- a/spec/features/listing_coaches_spec.rb +++ b/spec/features/listing_coaches_spec.rb @@ -4,7 +4,7 @@ workshop = Fabricate(:workshop, date_and_time: Time.zone.today.beginning_of_year + 1.month) coach = Fabricate(:attended_coach, workshop: workshop).member visit coaches_path - expect(page).to have_content(coach.name, wait: 5) + expect(page).to have_text(coach.name, wait: 5) end scenario 'I can see the top coaches by year' do diff --git a/spec/features/listing_events_spec.rb b/spec/features/listing_events_spec.rb index 95e7b64ee..ea8d83244 100644 --- a/spec/features/listing_events_spec.rb +++ b/spec/features/listing_events_spec.rb @@ -7,8 +7,8 @@ scenario 'displays upcoming events page' do travel_to(Time.current) do visit upcoming_events_path - expect(page).to have_content 'Upcoming Events' - expect(page).to have_content event.name + expect(page).to have_text 'Upcoming Events' + expect(page).to have_text event.name end end end @@ -21,8 +21,8 @@ scenario 'displays past events page' do travel_to(Time.current) do visit past_events_path - expect(page).to have_content 'Past Events' - expect(page).to have_content past_event.name + expect(page).to have_text 'Past Events' + expect(page).to have_text past_event.name end end end @@ -30,7 +30,7 @@ describe 'root /events redirects to /events/upcoming' do scenario 'redirects to upcoming events' do visit events_path - expect(page).to have_content 'Upcoming Events' + expect(page).to have_text 'Upcoming Events' expect(page).to have_current_path '/events/upcoming', ignore_query: true end end diff --git a/spec/features/manage_contact_preferences_spec.rb b/spec/features/manage_contact_preferences_spec.rb index d1c59a4fd..349524551 100644 --- a/spec/features/manage_contact_preferences_spec.rb +++ b/spec/features/manage_contact_preferences_spec.rb @@ -14,7 +14,7 @@ login_as_admin(manager) visit admin_sponsor_path(contact.sponsor) - expect(page).to have_content("#{contact.name} #{contact.surname} with email #{contact.email} subscribed to the Sponsor newsletter") + expect(page).to have_text("#{contact.name} #{contact.surname} with email #{contact.email} subscribed to the Sponsor newsletter") end end @@ -29,7 +29,7 @@ login_as_admin(manager) visit admin_sponsor_path(contact.sponsor) - expect(page).to have_content("#{contact.name} #{contact.surname} with email #{contact.email} unsubscribed from the Sponsor newsletter") + expect(page).to have_text("#{contact.name} #{contact.surname} with email #{contact.email} unsubscribed from the Sponsor newsletter") end end end diff --git a/spec/features/member/login_spec.rb b/spec/features/member/login_spec.rb index d576d2301..b2151710d 100644 --- a/spec/features/member/login_spec.rb +++ b/spec/features/member/login_spec.rb @@ -12,7 +12,7 @@ check 'terms_and_conditions_form_terms' click_on 'Accept' - expect(page).to have_content('Almost there...') + expect(page).to have_text('Almost there...') end end diff --git a/spec/features/member_feedback_spec.rb b/spec/features/member_feedback_spec.rb index dd26df765..30197d4ad 100644 --- a/spec/features/member_feedback_spec.rb +++ b/spec/features/member_feedback_spec.rb @@ -17,8 +17,8 @@ scenario 'I can access the feedback form when the token is valid' do visit feedback_path(valid_token) - expect(page).to have_content('Your submission will be completely anonymous') - expect(page).to have_content('Please do not mention any names') + expect(page).to have_text('Your submission will be completely anonymous') + expect(page).to have_text('Please do not mention any names') expect(page).to have_select 'feedback_coach_id' expect(page).to have_select 'feedback_tutorial_id' expect(page).to have_field 'feedback_request' @@ -90,14 +90,14 @@ visit feedback_path(invalid_token) expect(current_url).to eq(root_url) - expect(page).to have_content('You have already submitted feedback for this event.') + expect(page).to have_text('You have already submitted feedback for this event.') end scenario 'when feedback has been already submitted' do visit feedback_path(submited_token) expect(current_url).to eq(root_url) - expect(page).to have_content('You have already submitted feedback for this event.') + expect(page).to have_text('You have already submitted feedback for this event.') end end @@ -116,7 +116,7 @@ expect(page).to have_current_path(root_path) - expect(page).to have_content(feedback_submited_message) + expect(page).to have_text(feedback_submited_message) end scenario 'renders an error message when not all mandatory fields have been completed' do @@ -128,7 +128,7 @@ click_button('Submit feedback') expect(page).to have_current_path(submit_feedback_path(valid_token), ignore_query: true) - expect(page).to have_content("Rating can't be blank") + expect(page).to have_text("Rating can't be blank") end end end diff --git a/spec/features/member_joining_spec.rb b/spec/features/member_joining_spec.rb index 61527bf41..79be504a1 100644 --- a/spec/features/member_joining_spec.rb +++ b/spec/features/member_joining_spec.rb @@ -10,7 +10,7 @@ accept_toc - expect(page).to have_content('Thanks for signing up. Please fill in your details to complete the registration process.') + expect(page).to have_text('Thanks for signing up. Please fill in your details to complete the registration process.') expect(page).to have_current_path(edit_member_details_path(member_type: 'student')) end @@ -23,11 +23,11 @@ click_on 'Next' - expect(page).to have_content "First name can't be blank" - expect(page).to have_content "Surname can't be blank" - expect(page).to have_content "Email address can't be blank" - expect(page).to have_content "About you can't be blank" - expect(page).to have_content "You must select one option" + expect(page).to have_text "First name can't be blank" + expect(page).to have_text "Surname can't be blank" + expect(page).to have_text "Email address can't be blank" + expect(page).to have_text "About you can't be blank" + expect(page).to have_text "You must select one option" end scenario 'A new member details are successfully captured' do @@ -47,7 +47,7 @@ find_by_id('member_how_you_found_us_from_a_friend').click find_by_id('member_how_you_found_us_other').click - expect(page).to have_content('Please specify how you found us') + expect(page).to have_text('Please specify how you found us') fill_in 'member_how_you_found_us_other_reason', with: 'found on a poster', id: true click_on 'Next' @@ -55,9 +55,9 @@ click_on 'Done' - expect(page).to have_content('Pronouns') - expect(page).to have_content('she') - expect(page).to have_content('Jane Doe') + expect(page).to have_text('Pronouns') + expect(page).to have_text('she') + expect(page).to have_text('Jane Doe') expect(page).to have_link('jane@codebar.io') expect(page).to have_css('.badge', text: 'Vegan') expect(page).to have_css('.badge', text: 'Peanut allergy') diff --git a/spec/features/member_portal_spec.rb b/spec/features/member_portal_spec.rb index f7b3aeb7d..510cfd4c0 100644 --- a/spec/features/member_portal_spec.rb +++ b/spec/features/member_portal_spec.rb @@ -12,8 +12,8 @@ it 'can access the member dashboard' do visit dashboard_path - expect(page).to have_content('Dashboard') - expect(page).to have_content(member.full_name) + expect(page).to have_text('Dashboard') + expect(page).to have_text(member.full_name) end it 'can view attending workshops' do @@ -24,7 +24,7 @@ presenter = WorkshopPresenter.new(workshop) visit dashboard_path - expect(page).to have_content("#{presenter} at #{presenter.venue.name}", count: 1) + expect(page).to have_text("#{presenter} at #{presenter.venue.name}", count: 1) end it 'can view upcoming workshops for their chapters' do @@ -38,9 +38,9 @@ visit dashboard_path - expect(page).to have_content("#{c1_workshop_presenter} at #{c1_workshop_presenter.venue.name}", + expect(page).to have_text("#{c1_workshop_presenter} at #{c1_workshop_presenter.venue.name}", count: 1) - expect(page).to have_content("#{c2_workshop_presenter} at #{c2_workshop_presenter.venue.name}", + expect(page).to have_text("#{c2_workshop_presenter} at #{c2_workshop_presenter.venue.name}", count: 1) end end @@ -56,7 +56,7 @@ fill_in 'member_surname', with: 'Doe' click_button 'Save' - expect(page).to have_content('Jane Doe') + expect(page).to have_text('Jane Doe') end it 'can subscribe to groups' do @@ -74,10 +74,10 @@ invitations = 2.times.map { Fabricate(:attending_workshop_invitation, member: member) } visit invitations_path - expect(page).to have_content('Invitations') + expect(page).to have_text('Invitations') invitations.each do |invitation| - expect(page).to have_content(invitation.parent.to_s) - expect(page).to have_content(invitation.parent.chapter.name) + expect(page).to have_text(invitation.parent.to_s) + expect(page).to have_text(invitation.parent.chapter.name) end end end diff --git a/spec/features/member_updating_details_spec.rb b/spec/features/member_updating_details_spec.rb index 34ca91efa..698c81b85 100644 --- a/spec/features/member_updating_details_spec.rb +++ b/spec/features/member_updating_details_spec.rb @@ -11,7 +11,7 @@ check 'Vegetarian' click_on 'Save' - expect(page).to have_content('Your details have been updated.') + expect(page).to have_text('Your details have been updated.') expect(page).to have_css(".badge", text: "Vegetarian") end @@ -24,7 +24,7 @@ fill_in 'Other dietary restrictions', with: 'peanut allergy' click_on 'Save' - expect(page).to have_content('Your details have been updated.') + expect(page).to have_text('Your details have been updated.') expect(page).to have_css(".badge", text: 'Peanut allergy') member.reload expect(member.dietary_restrictions).to eq(['other']) @@ -39,7 +39,7 @@ uncheck 'Vegetarian' click_on 'Save' - expect(page).to have_content('Your details have been updated.') + expect(page).to have_text('Your details have been updated.') member.reload expect(member.dietary_restrictions).to be_empty end diff --git a/spec/features/subscribing_to_emails_spec.rb b/spec/features/subscribing_to_emails_spec.rb index 7d99f35ed..1caa02fe5 100644 --- a/spec/features/subscribing_to_emails_spec.rb +++ b/spec/features/subscribing_to_emails_spec.rb @@ -11,7 +11,7 @@ visit subscriptions_path click_on 'Subscribe' - expect(page).to have_content("You have subscribed to #{group.chapter.city}'s #{group.name} group") + expect(page).to have_text("You have subscribed to #{group.chapter.city}'s #{group.name} group") end scenario '#unsubscribe' do @@ -19,7 +19,7 @@ visit subscriptions_path click_on 'Subscribed' - expect(page).to have_content("You have unsubscribed from #{group.chapter.city}'s #{group.name} group") + expect(page).to have_text("You have unsubscribed from #{group.chapter.city}'s #{group.name} group") end end diff --git a/spec/features/subscribing_to_newsletter_spec.rb b/spec/features/subscribing_to_newsletter_spec.rb index c705e4115..baddeb2a1 100644 --- a/spec/features/subscribing_to_newsletter_spec.rb +++ b/spec/features/subscribing_to_newsletter_spec.rb @@ -69,7 +69,7 @@ visit subscriptions_path click_on 'Subscribe to newsletter' - expect(page).to have_content('You have subscribed to codebar\'s newsletter') + expect(page).to have_text('You have subscribed to codebar\'s newsletter') end scenario 'can unsubscribe if they are subscribed' do @@ -84,7 +84,7 @@ visit subscriptions_path click_on 'Unsubscribe from newsletter' - expect(page).to have_content('You have unsubscribed from codebar\'s newsletter') + expect(page).to have_text('You have unsubscribed from codebar\'s newsletter') end scenario 'can subscribe and then unsubscribe' do @@ -99,14 +99,14 @@ visit subscriptions_path click_on 'Subscribe to newsletter' - expect(page).to have_content('You have subscribed to codebar\'s newsletter') + expect(page).to have_text('You have subscribed to codebar\'s newsletter') expect(Services::MailingList).to receive(:new).and_return(mailing_list) expect(mailing_list).to receive(:unsubscribe) click_on 'Unsubscribe from newsletter' - expect(page).to have_content('You have unsubscribed from codebar\'s newsletter') + expect(page).to have_text('You have unsubscribed from codebar\'s newsletter') end end end diff --git a/spec/features/view_event_spec.rb b/spec/features/view_event_spec.rb index 0fc214559..3f6a7b4de 100644 --- a/spec/features/view_event_spec.rb +++ b/spec/features/view_event_spec.rb @@ -9,9 +9,9 @@ context 'a non authenticated user' do scenario 'a user can view an event' do - expect(page).to have_content(closed_event.name) - expect(page).to have_content(closed_event.description) - expect(page).to have_content(closed_event.schedule) + expect(page).to have_text(closed_event.name) + expect(page).to have_text(closed_event.description) + expect(page).to have_text(closed_event.schedule) end scenario 'a student cannot RSVP if they are not logged in' do @@ -41,7 +41,7 @@ click_on 'Attend as a coach' click_on 'RSVP' - expect(page).to have_content('Your spot has not yet been confirmed. We will verify your attendance after you complete the questionnaire.') + expect(page).to have_text('Your spot has not yet been confirmed. We will verify your attendance after you complete the questionnaire.') end scenario 'as a Student' do @@ -50,7 +50,7 @@ click_on 'Attend as a student' click_on 'RSVP' - expect(page).to have_content('Your spot has not yet been confirmed. We will verify your attendance after you complete the questionnaire.') + expect(page).to have_text('Your spot has not yet been confirmed. We will verify your attendance after you complete the questionnaire.') end end @@ -62,7 +62,7 @@ allow(Time).to receive(:now).and_return(travel_into_the_future) visit event_path(closed_event) - expect(page).to have_content('This event has already occurred.') + expect(page).to have_text('This event has already occurred.') expect(page).to have_no_button('Attend as a coach') expect(page).to have_no_button('Attend as a student') end @@ -89,8 +89,8 @@ click_on 'Attend as a coach' click_on 'RSVP' - expect(page).to have_content("Your spot has been confirmed for #{open_event.name}! We look forward to seeing you there") - expect(page).to have_no_content('We will verify your attendance after you complete the questionnaire!') + expect(page).to have_text("Your spot has been confirmed for #{open_event.name}! We look forward to seeing you there") + expect(page).to have_no_text('We will verify your attendance after you complete the questionnaire!') end scenario 'as a Student' do @@ -99,8 +99,8 @@ click_on 'Attend as a student' click_on 'RSVP' - expect(page).to have_content("Your spot has been confirmed for #{open_event.name}! We look forward to seeing you there") - expect(page).to have_no_content('We will verify your attendance after you complete the questionnaire!') + expect(page).to have_text("Your spot has been confirmed for #{open_event.name}! We look forward to seeing you there") + expect(page).to have_no_text('We will verify your attendance after you complete the questionnaire!') end end @@ -112,7 +112,7 @@ allow(Time).to receive(:now).and_return(travel_into_the_future) visit event_path(open_event) - expect(page).to have_content('This event has already occurred.') + expect(page).to have_text('This event has already occurred.') expect(page).to have_no_button('Attend as a coach') expect(page).to have_no_button('Attend as a student') end diff --git a/spec/features/viewing_a_meeting_spec.rb b/spec/features/viewing_a_meeting_spec.rb index e5fadc840..cdc47e78d 100644 --- a/spec/features/viewing_a_meeting_spec.rb +++ b/spec/features/viewing_a_meeting_spec.rb @@ -11,8 +11,8 @@ end scenario "can view a meeting's information" do - expect(page).to have_content meeting.name - expect(page).to have_content meeting.venue.name + expect(page).to have_text meeting.name + expect(page).to have_text meeting.venue.name end end @@ -25,11 +25,11 @@ click_on 'RSVP here' - expect(page).to have_content('Your RSVP was successful. We look forward to seeing you at the Monthly!') + expect(page).to have_text('Your RSVP was successful. We look forward to seeing you at the Monthly!') click_on "Can't make it anymore? Click here to cancel your spot." - expect(page).to have_content("Thanks for letting us know you can't make it") + expect(page).to have_text("Thanks for letting us know you can't make it") end end end diff --git a/spec/features/viewing_a_workshop_invitation_spec.rb b/spec/features/viewing_a_workshop_invitation_spec.rb index 1fcab7b5f..4d388977b 100644 --- a/spec/features/viewing_a_workshop_invitation_spec.rb +++ b/spec/features/viewing_a_workshop_invitation_spec.rb @@ -10,30 +10,30 @@ scenario 'workshop and page title' do expect(page).to have_title("Workshop invitation - #{humanize_date(workshop.date_and_time)}") - expect(page).to have_content("Workshop at #{workshop.host.name}") + expect(page).to have_text("Workshop at #{workshop.host.name}") end context '#introduction' do context 'student' do scenario 'displays information for a physical workshop' do - expect(page).to have_content('Please make sure you bring your laptop') + expect(page).to have_text('Please make sure you bring your laptop') end end context 'coach' do scenario 'displays information for a physical workshop' do - expect(page).to have_content('PS: There will also be food at the workshop.') + expect(page).to have_text('PS: There will also be food at the workshop.') end end end scenario 'venue name and address' do within '#venue' do - expect(page).to have_content(workshop.host.name) + expect(page).to have_text(workshop.host.name) within '#address' do - expect(page).to have_content(workshop.host.address.street) - expect(page).to have_content(workshop.host.address.city) + expect(page).to have_text(workshop.host.address.street) + expect(page).to have_text(workshop.host.address.city) end end end @@ -43,9 +43,9 @@ it 'contains details about the workshop and renders user defined HTML' do within '#info' do - expect(page).to have_content('Information about the workshop') + expect(page).to have_text('Information about the workshop') expect(page).to have_link('Follow link', href: 'http://a.link.com') - expect(page).to have_no_content('How to join') + expect(page).to have_no_text('How to join') end end end @@ -58,19 +58,19 @@ scenario 'workshop and page title' do expect(page).to have_title("Workshop invitation - #{humanize_date(workshop.date_and_time)}") - expect(page).to have_content("Virtual workshop for #{workshop.chapter.name}") + expect(page).to have_text("Virtual workshop for #{workshop.chapter.name}") end context '#introduction' do context 'student' do scenario 'does not display information about the physical workshop' do - expect(page).to have_no_content('Please make sure you bring your laptop') + expect(page).to have_no_text('Please make sure you bring your laptop') end end context 'coach' do scenario 'does not displays information about the physical workshop' do - expect(page).to have_no_content('PS: There will also be food at the workshop.') + expect(page).to have_no_text('PS: There will also be food at the workshop.') end end end @@ -81,14 +81,14 @@ it 'contains details about the workshop' do within '#info' do - expect(page).to have_content('Information about the workshop') + expect(page).to have_text('Information about the workshop') end end it 'contains details about how to join the workshop' do - expect(page).to have_content('How to join') + expect(page).to have_text('How to join') within '#join-info' do - expect(page).to have_content("Join ##{workshop.slack_channel}") + expect(page).to have_text("Join ##{workshop.slack_channel}") expect(page).to have_link(href: I18n.t('social_media_links.slack_html')) end end diff --git a/spec/features/viewing_a_workshop_spec.rb b/spec/features/viewing_a_workshop_spec.rb index a200021b2..291c6bcd3 100644 --- a/spec/features/viewing_a_workshop_spec.rb +++ b/spec/features/viewing_a_workshop_spec.rb @@ -10,16 +10,16 @@ describe '#details' do scenario 'workshop and page title' do expect(page).to have_title("Workshop at #{workshop.host.name} - #{humanize_date(workshop.date_and_time)}") - expect(page).to have_content("Workshop at #{workshop.host.name}") + expect(page).to have_text("Workshop at #{workshop.host.name}") end scenario 'venue name and address' do within '#venue' do - expect(page).to have_content(workshop.host.name) + expect(page).to have_text(workshop.host.name) within '#address' do - expect(page).to have_content(workshop.host.address.street) - expect(page).to have_content(workshop.host.address.city) + expect(page).to have_text(workshop.host.address.street) + expect(page).to have_text(workshop.host.address.city) end end end @@ -39,16 +39,16 @@ scenario 'workshop and page title' do expect(page) .to have_title("Virtual workshop for #{workshop.chapter.name} 🌐 #{humanize_date(workshop.date_and_time)}") - expect(page).to have_content("Virtual workshop for #{workshop.chapter.name}") + expect(page).to have_text("Virtual workshop for #{workshop.chapter.name}") end scenario 'workshop info' do within '*[data-test=workshop-info]' do - expect(page).to have_content('Participate in our online workshops') - expect(page).to have_content('Our virtual workshops take place online') + expect(page).to have_text('Participate in our online workshops') + expect(page).to have_text('Our virtual workshops take place online') within '.description' do - expect(page).to have_content(workshop.description) + expect(page).to have_text(workshop.description) end end end diff --git a/spec/features/viewing_pages_spec.rb b/spec/features/viewing_pages_spec.rb index bfeec0693..46225f8fd 100644 --- a/spec/features/viewing_pages_spec.rb +++ b/spec/features/viewing_pages_spec.rb @@ -3,20 +3,20 @@ visit root_path click_on 'Cookie Policy' - expect(page).to have_content('Cookies are small pieces of text used to store information on web browsers.') + expect(page).to have_text('Cookies are small pieces of text used to store information on web browsers.') end scenario 'can access and view the privacy policy' do visit root_path click_on 'Privacy Policy' - expect(page).to have_content('Your privacy means a lot to us') + expect(page).to have_text('Your privacy means a lot to us') end scenario 'can access page not found', js: true do visit '/does_not_exist' - expect(page).to have_content('Page not found') + expect(page).to have_text('Page not found') end end diff --git a/spec/features/visiting_homepage_spec.rb b/spec/features/visiting_homepage_spec.rb index fde1d8eaa..9466e155d 100644 --- a/spec/features/visiting_homepage_spec.rb +++ b/spec/features/visiting_homepage_spec.rb @@ -12,22 +12,22 @@ scenario 'i can view the next workshop' do travel_to(Time.current) do - expect(page).to have_content "Workshop at #{next_workshop.host.name}" + expect(page).to have_text "Workshop at #{next_workshop.host.name}" end end scenario 'i can view the next 5 upcoming events' do travel_to(Time.current) do - events.take(5).each { |event| expect(page).to have_content "#{event.name} at #{event.venue.name}" } + events.take(5).each { |event| expect(page).to have_text "#{event.name} at #{event.venue.name}" } end end scenario 'i can access the code of conduct' do click_on 'Code of Conduct' - expect(page).to have_content 'Code of conduct' - expect(page).to have_content 'The Quick Version' - expect(page).to have_content 'The Long Version' + expect(page).to have_text 'Code of conduct' + expect(page).to have_text 'The Quick Version' + expect(page).to have_text 'The Long Version' end scenario 'I can only view active chapters' do @@ -37,31 +37,31 @@ visit root_path active_chapters.each do |chapter| - expect(page).to have_content(chapter.name) + expect(page).to have_text(chapter.name) end inactive_chapters.each do |chapter| - expect(page).to have_no_content(chapter.name) + expect(page).to have_no_text(chapter.name) end end scenario 'i can sign in' do visit root_path - expect(page).to have_content 'Sign in' + expect(page).to have_text 'Sign in' end context 'signing up' do scenario 'i can sign up as a student' do visit root_path - expect(page).to have_content 'Join us as a student' + expect(page).to have_text 'Join us as a student' end scenario 'i can sign up as a coach' do visit root_path - expect(page).to have_content 'Join us as a coach' + expect(page).to have_text 'Join us as a coach' end end end diff --git a/spec/support/shared_examples/behaves_like_an_invitation_route.rb b/spec/support/shared_examples/behaves_like_an_invitation_route.rb index e9aa5796a..36c00f68f 100644 --- a/spec/support/shared_examples/behaves_like_an_invitation_route.rb +++ b/spec/support/shared_examples/behaves_like_an_invitation_route.rb @@ -16,14 +16,14 @@ click_on 'Attend' expect(page).to have_link 'I can no longer attend' - expect(page).to have_content("Thanks for getting back to us #{invitation.member.name}.") + expect(page).to have_text("Thanks for getting back to us #{invitation.member.name}.") expect(page).to have_current_path(invitation_route, ignore_query: true) # admin view login_as_admin(member) visit admin_workshop_path(invitation.workshop) within 'div.row.attendee.mt-3' do - expect(page).to have_content(member.full_name) + expect(page).to have_text(member.full_name) expect(page).to have_css('i.fa-history') expect(page).to have_no_css('i.fa-magic') end @@ -35,7 +35,7 @@ visit accept_invitation_route expect(page).to have_no_link 'I can no longer attend' - expect(page).to have_content('Tutorial must be selected') + expect(page).to have_text('Tutorial must be selected') end scenario 'a Coach must can RSVP diredctly' do @@ -44,7 +44,7 @@ expect(page).to have_link 'I can no longer attend' expect(page).to have_current_path(invitation_route, ignore_query: true) - expect(page).to have_content(I18n.t('messages.accepted_invitation', name: member.name)) + expect(page).to have_text(I18n.t('messages.accepted_invitation', name: member.name)) end end @@ -53,7 +53,7 @@ visit accept_invitation_route expect(current_url).to eq(invitation_url(invitation)) - expect(page).to have_content(I18n.t('messages.already_rsvped')) + expect(page).to have_text(I18n.t('messages.already_rsvped')) end scenario 'when there are no available spots' do @@ -61,7 +61,7 @@ visit invitation_route expect(current_url).to eq(invitation_url(invitation)) - expect(page).to have_content('The workshop is full') + expect(page).to have_text('The workshop is full') end scenario 'when there are no available spots and they accept through the invitation link' do @@ -69,7 +69,7 @@ visit accept_invitation_route expect(current_url).to eq(invitation_url(invitation)) - expect(page).to have_content('The workshop is full') + expect(page).to have_text('The workshop is full') end end @@ -79,7 +79,7 @@ visit invitation_route click_on 'I can no longer attend' - expect(page).to have_content(I18n.t('messages.rejected_invitation', name: invitation.member.name)) + expect(page).to have_text(I18n.t('messages.rejected_invitation', name: invitation.member.name)) end scenario 'when they are successful and there is someone else on the waiting list' do @@ -91,7 +91,7 @@ click_on 'I can no longer attend' - expect(page).to have_content(I18n.t('messages.rejected_invitation', name: invitation.member.name)) + expect(page).to have_text(I18n.t('messages.rejected_invitation', name: invitation.member.name)) expect(waitinglisted.reload.automated_rsvp).to eq(true) expect(waitinglisted.reload.rsvp_time).to_not be_nil expect(WaitingList.next_spot(invitation.workshop, invitation.role).present?).to eq(false) @@ -101,7 +101,7 @@ invitation.update_attribute(:attending, true) visit reject_invitation_route - expect(page).to have_content(I18n.t('messages.rejected_invitation', name: invitation.member.name)) + expect(page).to have_text(I18n.t('messages.rejected_invitation', name: invitation.member.name)) expect(page).to have_current_path(invitation_route, ignore_query: true) end @@ -110,14 +110,14 @@ visit invitation_route expect(page).to have_selector(:link_or_button, 'Attend') - expect(page).to have_no_content 'I can no longer attend' + expect(page).to have_no_text 'I can no longer attend' end scenario 'when already confirmed they are not attending and reject by accessing the link directly' do invitation.update_attribute(:attending, false) visit reject_invitation_route - expect(page).to have_content(I18n.t('messages.not_attending_already')) + expect(page).to have_text(I18n.t('messages.not_attending_already')) expect(page).to have_current_path(invitation_route, ignore_query: true) end @@ -130,7 +130,7 @@ visit invitation2_route click_on 'Attend' - expect(page).to have_content(I18n.t('messages.invitations.rsvped_to_other_workshop')) + expect(page).to have_text(I18n.t('messages.invitations.rsvped_to_other_workshop')) expect(page).to have_selector(:link_or_button, 'Attend') end @@ -141,14 +141,14 @@ visit accept_invitation_path(invitation2) - expect(page).to have_content(I18n.t('messages.invitations.rsvped_to_other_workshop')) + expect(page).to have_text(I18n.t('messages.invitations.rsvped_to_other_workshop')) end scenario 'when the event is less than 3.5 hours from now' do invitation.workshop.update_attribute(:date_and_time, Time.zone.now + 3.hours) visit reject_invitation_route - expect(page).to have_content('You can only change your RSVP status up to 3.5 hours before the workshop') + expect(page).to have_text('You can only change your RSVP status up to 3.5 hours before the workshop') expect(page).to have_current_path(invitation_route, ignore_query: true) end @@ -156,7 +156,7 @@ invitation.workshop.update_attribute(:date_and_time, Time.zone.now + 3.hours) visit reject_invitation_route - expect(page).to have_content('You can only change your RSVP status up to 3.5 hours before the workshop') + expect(page).to have_text('You can only change your RSVP status up to 3.5 hours before the workshop') expect(page).to have_current_path(invitation_route, ignore_query: true) end end @@ -167,10 +167,10 @@ visit invitation_route click_on 'Join the waiting list' - expect(page).to have_content('You have been added to the waiting list') + expect(page).to have_text('You have been added to the waiting list') click_on 'Remove from the waiting list' - expect(page).to have_content('You have been removed from the waiting list') + expect(page).to have_text('You have been removed from the waiting list') end end end diff --git a/spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb b/spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb index 5b23f1eef..ff8990d82 100644 --- a/spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb +++ b/spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb @@ -16,14 +16,14 @@ select tutorial.title, from: :workshop_invitation_tutorial click_on 'Attend' - expect(page).to have_content('See you at the workshop') + expect(page).to have_text('See you at the workshop') visit workshop_path(workshop) expect(page).to have_button('Manage your invitation') end it 'cannot RSVP as a coach' do - expect(page).to have_no_content('Attend as a coach') + expect(page).to have_no_text('Attend as a coach') end end @@ -37,14 +37,14 @@ click_on 'Attend as a coach' click_on 'Attend' - expect(page).to have_content('See you at the workshop') + expect(page).to have_text('See you at the workshop') visit workshop_path(workshop) expect(page).to have_button('Manage your invitation') end it 'cannot RSVP as a student' do - expect(page).to have_no_content('Attend as a student') + expect(page).to have_no_text('Attend as a student') end end @@ -63,7 +63,7 @@ select tutorial.title, from: :workshop_invitation_tutorial click_on 'Attend' - expect(page).to have_content('See you at the workshop') + expect(page).to have_text('See you at the workshop') visit workshop_path(workshop) expect(page).to have_button('Manage your invitation') @@ -73,7 +73,7 @@ click_on 'Attend as a coach' click_on 'Attend' - expect(page).to have_content('See you at the workshop') + expect(page).to have_text('See you at the workshop') visit workshop_path(workshop) expect(page).to have_button('Manage your invitation') @@ -98,8 +98,8 @@ visit workshop_path(workshop) click_on 'Manage your invitation' - expect(page).to have_content("Hi #{student.name}") - expect(page).to have_content('You should also go through our coaching guide') + expect(page).to have_text("Hi #{student.name}") + expect(page).to have_text('You should also go through our coaching guide') end end @@ -111,15 +111,15 @@ end it 'will be prompted to manage their subscriptions' do - expect(page).to have_content('Please tell us whether you want to attend as a student or coach.') + expect(page).to have_text('Please tell us whether you want to attend as a student or coach.') click_link 'Please tell us whether you want to attend as a student or coach.' expect(page).to have_current_path(subscriptions_path) end it 'cannot access RSVP as a student or coach' do - expect(page).to have_no_content('Attend as a student') - expect(page).to have_no_content('Attend as a coach') + expect(page).to have_no_text('Attend as a student') + expect(page).to have_no_text('Attend as a coach') end end end @@ -137,7 +137,7 @@ click_on 'Attend as a coach' click_on 'Attend' - expect(page).to have_content('See you at the workshop') + expect(page).to have_text('See you at the workshop') visit workshop_path(workshop_auto_rsvp_in_past) expect(page).to have_button('Manage your invitation') @@ -148,7 +148,7 @@ it 'cannot access RSVP as a student or coach' do visit workshop_path(workshop_auto_rsvp_in_future) - expect(page).to have_content('This workshop is not yet open for RSVP.') + expect(page).to have_text('This workshop is not yet open for RSVP.') end end @@ -172,7 +172,7 @@ allow(Time).to receive(:now).and_return(travel_into_the_future) click_on 'Attend as a coach' - expect(page).to have_content('This event has already taken place') + expect(page).to have_text('This event has already taken place') expect(page).to have_no_button('Attend as a coach') end end @@ -184,7 +184,7 @@ scenario 'cannot interact with a past event' do visit workshop_path(workshop) - expect(page).to have_content('has already taken place') + expect(page).to have_text('has already taken place') end end end diff --git a/spec/support/shared_examples/behaves_like_viewing_workshop_actions.rb b/spec/support/shared_examples/behaves_like_viewing_workshop_actions.rb index db0ef2f6a..fcd25f007 100644 --- a/spec/support/shared_examples/behaves_like_viewing_workshop_actions.rb +++ b/spec/support/shared_examples/behaves_like_viewing_workshop_actions.rb @@ -1,6 +1,6 @@ RSpec.shared_examples 'viewing workshop actions' do scenario 'signing up or signing in' do - expect(page).to have_content('Join our community') - expect(page).to have_content('Log in') + expect(page).to have_text('Join our community') + expect(page).to have_text('Log in') end end diff --git a/spec/support/shared_examples/behaves_like_viewing_workshop_details.rb b/spec/support/shared_examples/behaves_like_viewing_workshop_details.rb index ccc2a8924..bf7eba220 100644 --- a/spec/support/shared_examples/behaves_like_viewing_workshop_details.rb +++ b/spec/support/shared_examples/behaves_like_viewing_workshop_details.rb @@ -9,10 +9,10 @@ scenario 'organisers' do within '#organisers' do - expect(page).to have_content('Organisers') + expect(page).to have_text('Organisers') workshop.organisers.each do |organiser| - expect(page).to have_content(organiser.full_name) + expect(page).to have_text(organiser.full_name) end end end