From 2c9e600e5ce1951c4c0806beed287612d38b5186 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:38:08 +0000 Subject: [PATCH 1/3] Update rubocop-capybara to version 2.21.0 --- Gemfile.lock | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6f6e07aa..98bc09e9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -250,7 +250,7 @@ GEM thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - json (2.7.2) + json (2.8.2) json-schema (4.3.0) addressable (>= 2.8) jsonapi-renderer (0.2.2) @@ -360,7 +360,7 @@ GEM activerecord (>= 6.1) request_store (~> 1.4) parallel (1.26.3) - parser (3.3.5.0) + parser (3.3.6.0) ast (~> 2.4.1) racc pdf-core (0.10.0) @@ -438,7 +438,7 @@ GEM rake (13.2.1) recaptcha (5.17.0) redcarpet (3.6.0) - regexp_parser (2.9.2) + regexp_parser (2.9.3) request_store (1.7.0) rack (>= 1.4) responders (3.1.1) @@ -471,19 +471,19 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.1) - rubocop (1.66.1) + rubocop (1.69.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.32.2, < 2.0) + rubocop-ast (>= 1.36.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.32.3) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.36.2) parser (>= 3.3.1.0) - rubocop-capybara (2.20.0) + rubocop-capybara (2.21.0) rubocop (~> 1.41) rubocop-factory_bot (2.26.1) rubocop (~> 1.61) @@ -575,7 +575,9 @@ GEM concurrent-ruby (~> 1.0) uglifier (4.2.1) execjs (>= 0.3.0, < 3) - unicode-display_width (2.6.0) + unicode-display_width (3.1.2) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) unobtrusive_flash (3.3.1) railties uri (0.13.0) From 68e8203f2710c60b4fbfb1d4b6a401b8a0d19466 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Mon, 2 Dec 2024 11:43:43 +0100 Subject: [PATCH 2/3] Autocorrect - Lint/SafeNavigationConsistency - Capybara/NegationMatcher --- app/models/conference.rb | 6 +-- spec/features/cfp_ability_spec.rb | 24 +++++------ spec/features/info_desk_ability_spec.rb | 42 +++++++++---------- spec/features/organizer_ability_spec.rb | 2 +- spec/features/sponsor_spec.rb | 2 +- spec/features/track_organizer_ability_spec.rb | 38 ++++++++--------- 6 files changed, 57 insertions(+), 57 deletions(-) diff --git a/app/models/conference.rb b/app/models/conference.rb index 8c83f286..bb028574 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -156,7 +156,7 @@ class Conference < ApplicationRecord def get_submissions_per_week result = [] - if program&.cfp && program&.events + if program&.cfp && program.events submissions = program.events.select(:week).group(:week).order(:week).count start_week = program.cfp.start_week weeks = program.cfp.weeks @@ -172,7 +172,7 @@ class Conference < ApplicationRecord # ====Returns # * +Array+ -> e.g. 'Submitted' => [0, 3, 3, 5] -> first week 0 events, second week 3 events. def get_submissions_data - return [] unless program&.cfp && program&.events + return [] unless program&.cfp && program.events start_week = program.cfp.start_week get_events_per_week_by_state.collect do |state, values| @@ -265,7 +265,7 @@ class Conference < ApplicationRecord result = 0 weeks = 0 if registration_period&.start_date && - registration_period&.end_date + registration_period.end_date weeks = Date.new(registration_period.start_date.year, 12, 31) .strftime('%W').to_i diff --git a/spec/features/cfp_ability_spec.rb b/spec/features/cfp_ability_spec.rb index 2dd059cb..5c92250d 100644 --- a/spec/features/cfp_ability_spec.rb +++ b/spec/features/cfp_ability_spec.rb @@ -18,11 +18,11 @@ feature 'Has correct abilities' do expect(current_path).to eq(admin_conference_path(conference.short_title)) expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard') - expect(page).to_not have_link('Basics', href: "/admin/conferences/#{conference.short_title}/edit") + expect(page).to have_no_link('Basics', href: "/admin/conferences/#{conference.short_title}/edit") expect(page).to have_text('Basics') - expect(page).to_not have_link('Contact', href: "/admin/conferences/#{conference.short_title}/contact/edit") + expect(page).to have_no_link('Contact', href: "/admin/conferences/#{conference.short_title}/contact/edit") expect(page).to have_link('Commercials', href: "/admin/conferences/#{conference.short_title}/commercials") - expect(page).to_not have_link('Splashpage', href: "/admin/conferences/#{conference.short_title}/splashpage") + expect(page).to have_no_link('Splashpage', href: "/admin/conferences/#{conference.short_title}/splashpage") expect(page).to have_link('Venue', href: "/admin/conferences/#{conference.short_title}/venue") expect(page).to have_link('Rooms', href: "/admin/conferences/#{conference.short_title}/venue/rooms") expect(page).to have_link('Program', href: "/admin/conferences/#{conference.short_title}/program") @@ -33,18 +33,18 @@ feature 'Has correct abilities' do expect(page).to have_link('Difficulty Levels', href: "/admin/conferences/#{conference.short_title}/program/difficulty_levels") expect(page).to have_link('Schedules', href: "/admin/conferences/#{conference.short_title}/schedules") expect(page).to have_link('Reports', href: "/admin/conferences/#{conference.short_title}/program/reports") - expect(page).to_not have_link('Registrations', href: "/admin/conferences/#{conference.short_title}/registrations") - expect(page).to_not have_link('Questions', href: "/admin/conferences/#{conference.short_title}/questions") + expect(page).to have_no_link('Registrations', href: "/admin/conferences/#{conference.short_title}/registrations") + expect(page).to have_no_link('Questions', href: "/admin/conferences/#{conference.short_title}/questions") expect(page).to have_link('E-Mails', href: "/admin/conferences/#{conference.short_title}/emails") - expect(page).to_not have_link('Lodgings', href: "/admin/conferences/#{conference.short_title}/lodgings") - expect(page).to_not have_link('Registration Period', href: "/admin/conferences/#{conference.short_title}/registration_period") - expect(page).to_not have_text('Donations') - expect(page).to_not have_link('Sponsorship Levels', href: "/admin/conferences/#{conference.short_title}/sponsorship_levels") - expect(page).to_not have_link('Sponsors', href: "/admin/conferences/#{conference.short_title}/sponsors") - expect(page).to_not have_link('Tickets', href: "/admin/conferences/#{conference.short_title}/tickets") + expect(page).to have_no_link('Lodgings', href: "/admin/conferences/#{conference.short_title}/lodgings") + expect(page).to have_no_link('Registration Period', href: "/admin/conferences/#{conference.short_title}/registration_period") + expect(page).to have_no_text('Donations') + expect(page).to have_no_link('Sponsorship Levels', href: "/admin/conferences/#{conference.short_title}/sponsorship_levels") + expect(page).to have_no_link('Sponsors', href: "/admin/conferences/#{conference.short_title}/sponsors") + expect(page).to have_no_link('Tickets', href: "/admin/conferences/#{conference.short_title}/tickets") expect(page).to have_link('Roles', href: "/admin/conferences/#{conference.short_title}/roles") expect(page).to have_link('Resources', href: "/admin/conferences/#{conference.short_title}/resources") - expect(page).to_not have_link('New Conference', href: '/admin/conferences/new') + expect(page).to have_no_link('New Conference', href: '/admin/conferences/new') visit admin_conference_venue_rooms_path(conference.short_title) expect(current_path).to eq(admin_conference_venue_rooms_path(conference.short_title)) diff --git a/spec/features/info_desk_ability_spec.rb b/spec/features/info_desk_ability_spec.rb index daf89066..a65cdabc 100644 --- a/spec/features/info_desk_ability_spec.rb +++ b/spec/features/info_desk_ability_spec.rb @@ -17,34 +17,34 @@ feature 'Has correct abilities' do visit admin_conference_path(conference.short_title) expect(current_path).to eq(admin_conference_path(conference.short_title)) - expect(page).to_not have_link('Basics', href: "/admin/conferences/#{conference.short_title}/edit") + expect(page).to have_no_link('Basics', href: "/admin/conferences/#{conference.short_title}/edit") expect(page).to have_text('Basics') - expect(page).to_not have_link('Contact', href: "/admin/conferences/#{conference.short_title}/contact/edit") + expect(page).to have_no_link('Contact', href: "/admin/conferences/#{conference.short_title}/contact/edit") expect(page).to have_link('Commercials', href: "/admin/conferences/#{conference.short_title}/commercials") - expect(page).to_not have_link('Splashpage', href: "/admin/conferences/#{conference.short_title}/splashpage") - expect(page).to_not have_link('Lodgings', href: "/admin/conferences/#{conference.short_title}/lodgings") - expect(page).to_not have_link('Registration Period', href: "/admin/conferences/#{conference.short_title}/registration_period") - expect(page).to_not have_text('Donations') - expect(page).to_not have_link('Sponsorship Levels', href: "/admin/conferences/#{conference.short_title}/sponsorship_levels") - expect(page).to_not have_link('Sponsors', href: "/admin/conferences/#{conference.short_title}/sponsors") - expect(page).to_not have_link('Tickets', href: "/admin/conferences/#{conference.short_title}/tickets") + expect(page).to have_no_link('Splashpage', href: "/admin/conferences/#{conference.short_title}/splashpage") + expect(page).to have_no_link('Lodgings', href: "/admin/conferences/#{conference.short_title}/lodgings") + expect(page).to have_no_link('Registration Period', href: "/admin/conferences/#{conference.short_title}/registration_period") + expect(page).to have_no_text('Donations') + expect(page).to have_no_link('Sponsorship Levels', href: "/admin/conferences/#{conference.short_title}/sponsorship_levels") + expect(page).to have_no_link('Sponsors', href: "/admin/conferences/#{conference.short_title}/sponsors") + expect(page).to have_no_link('Tickets', href: "/admin/conferences/#{conference.short_title}/tickets") expect(page).to have_link('Roles', href: "/admin/conferences/#{conference.short_title}/roles") expect(page).to have_link('Resources', href: "/admin/conferences/#{conference.short_title}/resources") expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard') - expect(page).to_not have_link('Venue', href: "/admin/conferences/#{conference.short_title}/venue") - expect(page).to_not have_link('Rooms', href: "/admin/conferences/#{conference.short_title}/venue/rooms") - expect(page).to_not have_link('Program', href: "/admin/conferences/#{conference.short_title}/program") - expect(page).to_not have_link('Call for Papers', href: "/admin/conferences/#{conference.short_title}/program/cfps") - expect(page).to_not have_link('Events', href: "/admin/conferences/#{conference.short_title}/program/events") - expect(page).to_not have_link('Tracks', href: "/admin/conferences/#{conference.short_title}/program/tracks") - expect(page).to_not have_link('Event Types', href: "/admin/conferences/#{conference.short_title}/program/event_types") - expect(page).to_not have_link('Difficulty Levels', href: "/admin/conferences/#{conference.short_title}/program/difficulty_levels") - expect(page).to_not have_link('Schedules', href: "/admin/conferences/#{conference.short_title}/schedules") - expect(page).to_not have_link('Reports', href: "/admin/conferences/#{conference.short_title}/program/reports") + expect(page).to have_no_link('Venue', href: "/admin/conferences/#{conference.short_title}/venue") + expect(page).to have_no_link('Rooms', href: "/admin/conferences/#{conference.short_title}/venue/rooms") + expect(page).to have_no_link('Program', href: "/admin/conferences/#{conference.short_title}/program") + expect(page).to have_no_link('Call for Papers', href: "/admin/conferences/#{conference.short_title}/program/cfps") + expect(page).to have_no_link('Events', href: "/admin/conferences/#{conference.short_title}/program/events") + expect(page).to have_no_link('Tracks', href: "/admin/conferences/#{conference.short_title}/program/tracks") + expect(page).to have_no_link('Event Types', href: "/admin/conferences/#{conference.short_title}/program/event_types") + expect(page).to have_no_link('Difficulty Levels', href: "/admin/conferences/#{conference.short_title}/program/difficulty_levels") + expect(page).to have_no_link('Schedules', href: "/admin/conferences/#{conference.short_title}/schedules") + expect(page).to have_no_link('Reports', href: "/admin/conferences/#{conference.short_title}/program/reports") expect(page).to have_link('Registrations', href: "/admin/conferences/#{conference.short_title}/registrations") expect(page).to have_link('Questions', href: "/admin/conferences/#{conference.short_title}/questions") - expect(page).to_not have_link('E-Mails', href: "/admin/conferences/#{conference.short_title}/emails") - expect(page).to_not have_link('New Conference', href: '/admin/conferences/new') + expect(page).to have_no_link('E-Mails', href: "/admin/conferences/#{conference.short_title}/emails") + expect(page).to have_no_link('New Conference', href: '/admin/conferences/new') visit edit_admin_conference_path(conference.short_title) expect(current_path).to eq(root_path) diff --git a/spec/features/organizer_ability_spec.rb b/spec/features/organizer_ability_spec.rb index 5547e799..74d15cc1 100644 --- a/spec/features/organizer_ability_spec.rb +++ b/spec/features/organizer_ability_spec.rb @@ -46,7 +46,7 @@ feature 'Has correct abilities' do expect(page).to have_link('E-Mails', href: "/admin/conferences/#{conference.short_title}/emails") expect(page).to have_link('Roles', href: "/admin/conferences/#{conference.short_title}/roles") expect(page).to have_link('Resources', href: "/admin/conferences/#{conference.short_title}/resources") - expect(page).to_not have_link('New Conference', href: '/admin/conferences/new') + expect(page).to have_no_link('New Conference', href: '/admin/conferences/new') visit admin_conference_path(other_conference.short_title) expect(page).to have_link('Add venue', href: "/admin/conferences/#{other_conference.short_title}/venue/new") diff --git a/spec/features/sponsor_spec.rb b/spec/features/sponsor_spec.rb index e64946ea..9366c11f 100644 --- a/spec/features/sponsor_spec.rb +++ b/spec/features/sponsor_spec.rb @@ -47,7 +47,7 @@ feature Sponsor do end page.find('#flash') expect(flash).to eq('Sponsor successfully deleted.') - expect(page).to_not have_selector('table#sponsors') + expect(page).to have_no_selector('table#sponsors') end end diff --git a/spec/features/track_organizer_ability_spec.rb b/spec/features/track_organizer_ability_spec.rb index 8ad930eb..6975135d 100644 --- a/spec/features/track_organizer_ability_spec.rb +++ b/spec/features/track_organizer_ability_spec.rb @@ -19,33 +19,33 @@ feature 'Has correct abilities' do expect(current_path).to eq(admin_conference_path(conference.short_title)) expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard') - expect(page).to_not have_link('Basics', href: "/admin/conferences/#{conference.short_title}/edit") + expect(page).to have_no_link('Basics', href: "/admin/conferences/#{conference.short_title}/edit") expect(page).to have_text('Basics') - expect(page).to_not have_link('Contact', href: "/admin/conferences/#{conference.short_title}/contact/edit") + expect(page).to have_no_link('Contact', href: "/admin/conferences/#{conference.short_title}/contact/edit") expect(page).to have_link('Commercials', href: "/admin/conferences/#{conference.short_title}/commercials") - expect(page).to_not have_link('Splashpage', href: "/admin/conferences/#{conference.short_title}/splashpage") - expect(page).to_not have_link('Venue', href: "/admin/conferences/#{conference.short_title}/venue") - expect(page).to_not have_link('Rooms', href: "/admin/conferences/#{conference.short_title}/venue/rooms") - expect(page).to_not have_link('Lodgings', href: "/admin/conferences/#{conference.short_title}/lodgings") + expect(page).to have_no_link('Splashpage', href: "/admin/conferences/#{conference.short_title}/splashpage") + expect(page).to have_no_link('Venue', href: "/admin/conferences/#{conference.short_title}/venue") + expect(page).to have_no_link('Rooms', href: "/admin/conferences/#{conference.short_title}/venue/rooms") + expect(page).to have_no_link('Lodgings', href: "/admin/conferences/#{conference.short_title}/lodgings") expect(page).to have_link('Program', href: "/admin/conferences/#{conference.short_title}/program") - expect(page).to_not have_link('Call for Papers', href: "/admin/conferences/#{conference.short_title}/program/cfps") + expect(page).to have_no_link('Call for Papers', href: "/admin/conferences/#{conference.short_title}/program/cfps") expect(page).to have_link('Events', href: "/admin/conferences/#{conference.short_title}/program/events") expect(page).to have_link('Tracks', href: "/admin/conferences/#{conference.short_title}/program/tracks") - expect(page).to_not have_link('Event Types', href: "/admin/conferences/#{conference.short_title}/program/event_types") - expect(page).to_not have_link('Difficulty Levels', href: "/admin/conferences/#{conference.short_title}/program/difficulty_levels") + expect(page).to have_no_link('Event Types', href: "/admin/conferences/#{conference.short_title}/program/event_types") + expect(page).to have_no_link('Difficulty Levels', href: "/admin/conferences/#{conference.short_title}/program/difficulty_levels") expect(page).to have_link('Schedules', href: "/admin/conferences/#{conference.short_title}/schedules") expect(page).to have_link('Reports', href: "/admin/conferences/#{conference.short_title}/program/reports") - expect(page).to_not have_link('Registrations', href: "/admin/conferences/#{conference.short_title}/registrations") - expect(page).to_not have_link('Registration Period', href: "/admin/conferences/#{conference.short_title}/registration_period") - expect(page).to_not have_link('Questions', href: "/admin/conferences/#{conference.short_title}/questions") - expect(page).to_not have_text('Donations') - expect(page).to_not have_link('Sponsorship Levels', href: "/admin/conferences/#{conference.short_title}/sponsorship_levels") - expect(page).to_not have_link('Sponsors', href: "/admin/conferences/#{conference.short_title}/sponsors") - expect(page).to_not have_link('Tickets', href: "/admin/conferences/#{conference.short_title}/tickets") - expect(page).to_not have_link('E-Mails', href: "/admin/conferences/#{conference.short_title}/emails") + expect(page).to have_no_link('Registrations', href: "/admin/conferences/#{conference.short_title}/registrations") + expect(page).to have_no_link('Registration Period', href: "/admin/conferences/#{conference.short_title}/registration_period") + expect(page).to have_no_link('Questions', href: "/admin/conferences/#{conference.short_title}/questions") + expect(page).to have_no_text('Donations') + expect(page).to have_no_link('Sponsorship Levels', href: "/admin/conferences/#{conference.short_title}/sponsorship_levels") + expect(page).to have_no_link('Sponsors', href: "/admin/conferences/#{conference.short_title}/sponsors") + expect(page).to have_no_link('Tickets', href: "/admin/conferences/#{conference.short_title}/tickets") + expect(page).to have_no_link('E-Mails', href: "/admin/conferences/#{conference.short_title}/emails") expect(page).to have_link('Roles', href: "/admin/conferences/#{conference.short_title}/roles") - expect(page).to_not have_link('Resources', href: "/admin/conferences/#{conference.short_title}/resources") - expect(page).to_not have_link('New Conference', href: '/admin/conferences/new') + expect(page).to have_no_link('Resources', href: "/admin/conferences/#{conference.short_title}/resources") + expect(page).to have_no_link('New Conference', href: '/admin/conferences/new') visit edit_admin_conference_path(conference.short_title) expect(current_path).to eq root_path From e1e7c1858674f133ff120a7e86d535c49336b579 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Mon, 2 Dec 2024 11:46:33 +0100 Subject: [PATCH 3/3] Autocorrect Style/SafeNavigation --- app/models/conference.rb | 5 +---- app/models/event_schedule.rb | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/models/conference.rb b/app/models/conference.rb index bb028574..90a45345 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -196,10 +196,7 @@ class Conference < ApplicationRecord # ====Returns # * +Array+ -> e.g. [0, 3, 3, 5] -> first week 0, second week 3 registrations def get_registrations_per_week - return [] unless registrations && - registration_period && - registration_period.start_date && - registration_period.end_date + return [] unless registrations && registration_period&.start_date && registration_period.end_date reg = registrations.group(:week).order(:week).count start_week = get_registration_start_week diff --git a/app/models/event_schedule.rb b/app/models/event_schedule.rb index 5358f0bc..8c5e9753 100644 --- a/app/models/event_schedule.rb +++ b/app/models/event_schedule.rb @@ -82,13 +82,13 @@ class EventSchedule < ApplicationRecord end def start_after_end_hour - return unless event && start_time && event.program && event.program.conference && event.program.conference.end_hour + return unless event && start_time && event.program&.conference && event.program.conference.end_hour errors.add(:start_time, "can't be after the conference end hour (#{event.program.conference.end_hour})") if start_time.hour >= event.program.conference.end_hour end def start_before_start_hour - return unless event && start_time && event.program && event.program.conference && event.program.conference.start_hour + return unless event && start_time && event.program&.conference && event.program.conference.start_hour errors.add(:start_time, "can't be before the conference start hour (#{event.program.conference.start_hour})") if start_time.hour < event.program.conference.start_hour end