From 819f413bcba34a5a28134857d1462200c1e45ea2 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 08:40:27 +0200 Subject: [PATCH 1/8] style: Fix RSpec/EmptyLineAfterHook offenses Fix RSpec/EmptyLineAfterHook offenses in: - spec/controllers/admin/member_search_controller_spec.rb - spec/models/workshop_invitation_spec.rb - spec/models/workshop_spec.rb Regenerate .rubocop_todo.yml. --- .rubocop_todo.yml | 11 +---------- .../admin/member_search_controller_spec.rb | 4 ++++ spec/models/workshop_invitation_spec.rb | 1 + spec/models/workshop_spec.rb | 1 + 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0a51db18e..c602e73b5 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:26:09 UTC using RuboCop version 1.88.2. +# on 2026-07-28 06:40:25 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 @@ -604,15 +604,6 @@ RSpec/EmptyLineAfterFinalLet: - 'spec/lib/tasks/delete_member_rake_spec.rb' - 'spec/models/sponsor_spec.rb' -# Offense count: 6 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowConsecutiveOneLiners. -RSpec/EmptyLineAfterHook: - Exclude: - - 'spec/controllers/admin/member_search_controller_spec.rb' - - 'spec/models/workshop_invitation_spec.rb' - - 'spec/models/workshop_spec.rb' - # Offense count: 4 # This cop supports safe autocorrection (--autocorrect). RSpec/EmptyLineAfterSubject: diff --git a/spec/controllers/admin/member_search_controller_spec.rb b/spec/controllers/admin/member_search_controller_spec.rb index 9cdab3db3..bf2f4258b 100644 --- a/spec/controllers/admin/member_search_controller_spec.rb +++ b/spec/controllers/admin/member_search_controller_spec.rb @@ -6,6 +6,7 @@ before do get :index end + it "redirects to the home page" do expect(response).to redirect_to(root_path) end @@ -19,6 +20,7 @@ login_as_admin(member) get :index end + it "shows user the search page" do expect(response).to have_http_status(:ok) end @@ -29,6 +31,7 @@ allow(fake_relation).to receive(:select).with(any_args).and_return([fake_juliet]) get :index, params: { member_search: { name: "Juliet", callback_url: root_path } } end + it "redirects to the calling service" do expect(response).to have_http_status(:found) @@ -47,6 +50,7 @@ allow(fake_relation).to receive(:select).with(any_args).and_return([fake_juliet, fake_romeo]) get :index, params: { member_search: { name: 'e', callback_url: root_path } } end + it "presents the found members on the index page" do expect(response).to have_http_status(:ok) end diff --git a/spec/models/workshop_invitation_spec.rb b/spec/models/workshop_invitation_spec.rb index 6c8be9522..c0d913dd8 100644 --- a/spec/models/workshop_invitation_spec.rb +++ b/spec/models/workshop_invitation_spec.rb @@ -14,6 +14,7 @@ context 'if Student invitation' do before { allow(subject).to receive(:student_attending?).and_return(true) } + it { is_expected.to validate_presence_of(:tutorial) } it { is_expected.to validate_presence_of(:tutorial).on(:waitinglist) } end diff --git a/spec/models/workshop_spec.rb b/spec/models/workshop_spec.rb index 50700b0aa..f06504d29 100644 --- a/spec/models/workshop_spec.rb +++ b/spec/models/workshop_spec.rb @@ -40,6 +40,7 @@ context 'if virtual' do before { allow(subject).to receive(:virtual?).and_return(true) } + it { is_expected.to validate_presence_of(:slack_channel) } it { is_expected.to validate_presence_of(:slack_channel_link) } it { is_expected.to validate_numericality_of(:student_spaces).is_greater_than(0) } From 76afcb6db1e8b23353af33d154f04579da09bbbb Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 08:40:48 +0200 Subject: [PATCH 2/8] style: Fix RSpec/EmptyLineAfterSubject offenses Fix RSpec/EmptyLineAfterSubject offenses in: - spec/models/event_spec.rb - spec/models/meeting_spec.rb - spec/models/workshop_invitation_spec.rb - spec/models/workshop_spec.rb Regenerate .rubocop_todo.yml. --- .rubocop_todo.yml | 11 +---------- spec/models/event_spec.rb | 1 + spec/models/meeting_spec.rb | 1 + spec/models/workshop_invitation_spec.rb | 1 + spec/models/workshop_spec.rb | 1 + 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c602e73b5..89bdfab6f 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:40:25 UTC using RuboCop version 1.88.2. +# on 2026-07-28 06:40:46 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 @@ -604,15 +604,6 @@ RSpec/EmptyLineAfterFinalLet: - 'spec/lib/tasks/delete_member_rake_spec.rb' - 'spec/models/sponsor_spec.rb' -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -RSpec/EmptyLineAfterSubject: - Exclude: - - 'spec/models/event_spec.rb' - - 'spec/models/meeting_spec.rb' - - 'spec/models/workshop_invitation_spec.rb' - - 'spec/models/workshop_spec.rb' - # Offense count: 57 # Configuration parameters: Max, CountAsOne. RSpec/ExampleLength: diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index 08a56e145..e8e2edf7b 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -1,5 +1,6 @@ RSpec.describe Event do subject(:event) { Fabricate(:event) } + include_examples "Invitable", :invitation, :event include_examples DateTimeConcerns, :event diff --git a/spec/models/meeting_spec.rb b/spec/models/meeting_spec.rb index 4f47a1252..9a1b0dcb3 100644 --- a/spec/models/meeting_spec.rb +++ b/spec/models/meeting_spec.rb @@ -4,6 +4,7 @@ context 'validations' do subject(:meeting) { Fabricate(:meeting) } + it { is_expected.to validate_presence_of(:date_and_time) } it { is_expected.to validate_presence_of(:ends_at) } it { should belong_to(:venue) } diff --git a/spec/models/workshop_invitation_spec.rb b/spec/models/workshop_invitation_spec.rb index c0d913dd8..878d028b9 100644 --- a/spec/models/workshop_invitation_spec.rb +++ b/spec/models/workshop_invitation_spec.rb @@ -1,5 +1,6 @@ RSpec.describe WorkshopInvitation do subject(:workshop_invitation) { Fabricate(:workshop_invitation) } + it_behaves_like InvitationConcerns, :workshop_invitation, :workshop context 'defaults' do diff --git a/spec/models/workshop_spec.rb b/spec/models/workshop_spec.rb index f06504d29..8b340c369 100644 --- a/spec/models/workshop_spec.rb +++ b/spec/models/workshop_spec.rb @@ -1,5 +1,6 @@ RSpec.describe Workshop do subject(:workshop) { Fabricate(:workshop) } + include_examples "Invitable", :workshop_invitation, :workshop include_examples DateTimeConcerns, :workshop From 2641a68328b475360bf4350234a190c6339f17fb Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 08:41:09 +0200 Subject: [PATCH 3/8] style: Fix RSpec/EmptyLineAfterFinalLet offenses Fix RSpec/EmptyLineAfterFinalLet offenses in: - spec/lib/tasks/delete_member_rake_spec.rb - spec/models/sponsor_spec.rb Regenerate .rubocop_todo.yml. --- .rubocop_todo.yml | 9 +-------- spec/lib/tasks/delete_member_rake_spec.rb | 1 + spec/models/sponsor_spec.rb | 1 + 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 89bdfab6f..f09d924a9 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:40:46 UTC using RuboCop version 1.88.2. +# on 2026-07-28 06:41:07 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 @@ -597,13 +597,6 @@ RSpec/EmptyLineAfterExampleGroup: Exclude: - 'spec/features/admin/manage_sponsor_spec.rb' -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -RSpec/EmptyLineAfterFinalLet: - Exclude: - - 'spec/lib/tasks/delete_member_rake_spec.rb' - - 'spec/models/sponsor_spec.rb' - # Offense count: 57 # Configuration parameters: Max, CountAsOne. RSpec/ExampleLength: diff --git a/spec/lib/tasks/delete_member_rake_spec.rb b/spec/lib/tasks/delete_member_rake_spec.rb index 581b18ef9..b4bc8e357 100644 --- a/spec/lib/tasks/delete_member_rake_spec.rb +++ b/spec/lib/tasks/delete_member_rake_spec.rb @@ -1,5 +1,6 @@ RSpec.describe 'rake member:delete', type: :task do let!(:member) { Fabricate.create(:member) } + before do allow($stdout).to receive(:puts) end diff --git a/spec/models/sponsor_spec.rb b/spec/models/sponsor_spec.rb index 7e8d4d76c..7e66e8290 100644 --- a/spec/models/sponsor_spec.rb +++ b/spec/models/sponsor_spec.rb @@ -15,6 +15,7 @@ context 'scopes' do describe 'searching by_name' do let!(:search_sponsor) { Fabricate(:sponsor, name: 'codebar') } + before do Fabricate.times(2, :sponsor) end From ecff32900c175efe7c5807169d03af793e2c09fc Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 08:42:52 +0200 Subject: [PATCH 4/8] style: Fix RSpec/ExpectInHook offenses Fix RSpec/ExpectInHook offenses by moving expectations out of before and after hooks into the relevant example bodies: - spec/controllers/admin/invitations_controller_spec.rb - spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb Regenerate .rubocop_todo.yml. --- .rubocop_todo.yml | 16 ++-------------- .../admin/invitations_controller_spec.rb | 4 ++-- .../behaves_like_managing_workshop_attendance.rb | 2 -- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f09d924a9..192301fed 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:41:07 UTC using RuboCop version 1.88.2. +# on 2026-07-28 06:42:50 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 @@ -665,12 +665,6 @@ RSpec/ExpectChange: - 'spec/features/member/login_spec.rb' - 'spec/models/feedback_spec.rb' -# Offense count: 2 -RSpec/ExpectInHook: - Exclude: - - 'spec/controllers/admin/invitations_controller_spec.rb' - - 'spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb' - # Offense count: 10 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. @@ -685,12 +679,6 @@ RSpec/HookArgument: - 'spec/presenters/sponsor_presenter_spec.rb' - 'spec/spec_helper.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -RSpec/HooksBeforeExamples: - Exclude: - - 'spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb' - # Offense count: 9 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. @@ -795,7 +783,7 @@ RSpec/MetadataStyle: - 'spec/features/viewing_pages_spec.rb' - 'spec/spec_helper.rb' -# Offense count: 134 +# Offense count: 135 # Configuration parameters: Max. RSpec/MultipleExpectations: Exclude: diff --git a/spec/controllers/admin/invitations_controller_spec.rb b/spec/controllers/admin/invitations_controller_spec.rb index 723fa4809..59bd91f3e 100644 --- a/spec/controllers/admin/invitations_controller_spec.rb +++ b/spec/controllers/admin/invitations_controller_spec.rb @@ -9,11 +9,11 @@ login admin request.env["HTTP_REFERER"] = "/admin/member/3" - - expect(invitation.attending).to be_nil end it "Successfuly updates an invitation" do + expect(invitation.attending).to be_nil + put :update, params: { id: invitation.token, workshop_id: workshop.id, attending: "true" } expect(invitation.reload.attending).to be true 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 df6c37d78..4b74e3eee 100644 --- a/spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb +++ b/spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb @@ -138,9 +138,7 @@ click_on 'Attend' expect(page).to have_content('See you at the workshop') - end - after do visit workshop_path(workshop_auto_rsvp_in_past) expect(page).to have_button('Manage your invitation') end From c991955113856ed4cfab9f96f7b16395cc323b57 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 08:43:17 +0200 Subject: [PATCH 5/8] style: Fix RSpec/HooksBeforeExamples offense Fix RSpec/HooksBeforeExamples offense in spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb and regenerate .rubocop_todo.yml. --- .rubocop_todo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 192301fed..9eeadbbab 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:42:50 UTC using RuboCop version 1.88.2. +# on 2026-07-28 06:43:15 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 From dc975eb72833c5ffe3b57069bca247435bc40b41 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 08:43:34 +0200 Subject: [PATCH 6/8] style: Fix RSpec/EmptyLineAfterExampleGroup offense Fix RSpec/EmptyLineAfterExampleGroup offense in spec/features/admin/manage_sponsor_spec.rb and regenerate .rubocop_todo.yml. --- .rubocop_todo.yml | 8 +------- spec/features/admin/manage_sponsor_spec.rb | 1 + 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 9eeadbbab..801d3f984 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:43:15 UTC using RuboCop version 1.88.2. +# on 2026-07-28 06:43:32 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 @@ -591,12 +591,6 @@ RSpec/EmptyExampleGroup: Exclude: - 'spec/models/address_spec.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -RSpec/EmptyLineAfterExampleGroup: - Exclude: - - 'spec/features/admin/manage_sponsor_spec.rb' - # Offense count: 57 # Configuration parameters: Max, CountAsOne. RSpec/ExampleLength: diff --git a/spec/features/admin/manage_sponsor_spec.rb b/spec/features/admin/manage_sponsor_spec.rb index e24b3d7bf..782580f4f 100644 --- a/spec/features/admin/manage_sponsor_spec.rb +++ b/spec/features/admin/manage_sponsor_spec.rb @@ -78,6 +78,7 @@ expect(page).to have_content 'Office is located on the third floor.' end end + context 'with existing avatar' do it 'shows the current avatar on the edit page' do sponsor = Fabricate(:sponsor) From 078cb1ec06c0944a2e08e86f1365d376dc972695 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 08:51:53 +0200 Subject: [PATCH 7/8] style: Fix RSpec/NoExpectationExample offenses Fix RSpec/NoExpectationExample offenses in spec/lib/services/flodesk_spec.rb by asserting the response of subscribe/unsubscribe, and regenerate .rubocop_todo.yml. --- .rubocop_todo.yml | 9 +-------- spec/lib/services/flodesk_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 801d3f984..3dd6e8597 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:43:32 UTC using RuboCop version 1.88.2. +# on 2026-07-28 06:51:51 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 @@ -880,13 +880,6 @@ RSpec/NamedSubject: - 'spec/policies/testimonial_policy_spec.rb' - 'spec/policies/workshop_policy_spec.rb' -# Offense count: 2 -# Configuration parameters: AllowedPatterns. -# AllowedPatterns: ^expect_, ^assert_ -RSpec/NoExpectationExample: - Exclude: - - 'spec/lib/services/flodesk_spec.rb' - # Offense count: 42 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. diff --git a/spec/lib/services/flodesk_spec.rb b/spec/lib/services/flodesk_spec.rb index 194b02dae..ec7850fed 100644 --- a/spec/lib/services/flodesk_spec.rb +++ b/spec/lib/services/flodesk_spec.rb @@ -29,7 +29,7 @@ check = ->(request_body) { request_body == payload } stub.post('/subscribers', check) { [200, {}, '{}'] } - client.subscribe(**payload) + expect(client.subscribe(**payload)).to include(status: 200) stub.verify_stubbed_calls end @@ -49,7 +49,7 @@ # Faraday's `stub.delete` does not accept body at the time of writing stub.send(:new_stub, :delete, "/subscribers/#{payload[:email]}/segments", {}, check) { [200, {}, '{}'] } - client.unsubscribe(**payload) + expect(client.unsubscribe(**payload)).to include(status: 200) stub.verify_stubbed_calls end From f2428e96c60f65ef7d210a355af9e12286d97930 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Tue, 28 Jul 2026 08:52:08 +0200 Subject: [PATCH 8/8] style: Fix RSpec/EmptyExampleGroup offense Remove the empty spec/models/address_spec.rb and regenerate .rubocop_todo.yml. --- .rubocop_todo.yml | 8 +------- spec/models/address_spec.rb | 3 --- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 spec/models/address_spec.rb diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 3dd6e8597..c9e8bc6e5 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:51:51 UTC using RuboCop version 1.88.2. +# on 2026-07-28 06:52: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 @@ -585,12 +585,6 @@ RSpec/ContextWording: - 'spec/support/shared_examples/behaves_like_invitable.rb' - 'spec/support/shared_examples/behaves_like_managing_workshop_attendance.rb' -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -RSpec/EmptyExampleGroup: - Exclude: - - 'spec/models/address_spec.rb' - # Offense count: 57 # Configuration parameters: Max, CountAsOne. RSpec/ExampleLength: diff --git a/spec/models/address_spec.rb b/spec/models/address_spec.rb deleted file mode 100644 index e2fba0dc4..000000000 --- a/spec/models/address_spec.rb +++ /dev/null @@ -1,3 +0,0 @@ -RSpec.describe Address do - subject(:address) { Fabricate.build(:address) } -end