diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0a51db18e..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:26:09 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,43 +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: 1 -# This cop supports safe autocorrection (--autocorrect). -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: 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: - 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: @@ -690,12 +653,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. @@ -710,12 +667,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. @@ -820,7 +771,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: @@ -923,13 +874,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/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/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/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) 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 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/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 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/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 diff --git a/spec/models/workshop_invitation_spec.rb b/spec/models/workshop_invitation_spec.rb index 6c8be9522..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 @@ -14,6 +15,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..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 @@ -40,6 +41,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) } 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