Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 2 additions & 78 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit`
# on 2026-07-28 16:48:26 UTC using RuboCop version 1.88.2.
# on 2026-07-30 08:58:12 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
Expand All @@ -18,7 +18,6 @@ Capybara/RSpec/VisibilityMatcher:
Exclude:
- 'spec/components/chapters_sidebar_component_spec.rb'


# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowSafeAssignment.
Expand Down Expand Up @@ -52,13 +51,6 @@ Lint/UnderscorePrefixedVariableName:
Exclude:
- 'spec/models/group_spec.rb'

# Offense count: 5
# This cop supports unsafe autocorrection (--autocorrect-all).
Lint/UselessTimes:
Exclude:
- 'spec/models/event_spec.rb'
- 'spec/models/workshop_spec.rb'

# Offense count: 32
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
Metrics/AbcSize:
Expand Down Expand Up @@ -102,15 +94,14 @@ Metrics/ClassLength:
- 'lib/omniauth/strategies/codebar.rb'
- 'lib/tasks/setup.rake'

# Offense count: 9
# Offense count: 8
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
Metrics/CyclomaticComplexity:
Exclude:
- 'app/controllers/admin/chapters_controller.rb'
- 'app/controllers/auth_services_controller.rb'
- 'app/controllers/invitations_controller.rb'
- 'app/controllers/workshop_invitation_controller.rb'
- 'app/presenters/how_you_found_us_presenter.rb'
- 'app/services/invitation_manager.rb'
- 'lib/flodesk.rb'
- 'lib/omniauth/strategies/codebar.rb'
Expand Down Expand Up @@ -164,7 +155,6 @@ Naming/AccessorMethodName:
- 'app/controllers/admin/workshops_controller.rb'
- 'app/controllers/feedback_controller.rb'


# Offense count: 1
# Configuration parameters: EnforcedStyle, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
# SupportedStyles: snake_case, camelCase
Expand All @@ -189,45 +179,18 @@ Naming/PredicatePrefix:
- 'app/policies/event_policy.rb'
- 'app/policies/workshop_policy.rb'



# Offense count: 2
RSpec/AnyInstance:
Exclude:
- 'spec/controllers/member/details_controller_spec.rb'
- 'spec/support/helpers/login_helpers.rb'


# Offense count: 1
# Configuration parameters: Max, CountAsOne.
RSpec/ExampleLength:
Exclude:
- 'spec/features/admin/event_spec.rb'

# Offense count: 68
# Configuration parameters: EnforcedStyle.
# SupportedStyles: have_received, receive
RSpec/MessageSpies:
Exclude:
- 'spec/controllers/admin/members_controller_spec.rb'
- 'spec/controllers/payments_controller_spec.rb'
- 'spec/features/admin/workshops_spec.rb'
- 'spec/features/subscribing_to_newsletter_spec.rb'
- 'spec/helpers/email_header_helper_spec.rb'
- 'spec/lib/services/mailing_list_spec.rb'
- 'spec/lib/tasks/feedback_rake_spec.rb'
- 'spec/lib/tasks/mailing_list_rake_spec.rb'
- 'spec/lib/tasks/reminders_meeting_rake_spec.rb'
- 'spec/lib/tasks/reminders_workshop_rake_spec.rb'
- 'spec/presenters/meeting_presenter_spec.rb'
- 'spec/presenters/member_presenter_spec.rb'
- 'spec/presenters/sponsor_presenter_spec.rb'
- 'spec/presenters/virtual_workshop_presenter_spec.rb'
- 'spec/presenters/workshop_presenter_spec.rb'
- 'spec/services/invitation_manager_spec.rb'
- 'spec/support/shared_examples/behaves_like_an_invitation.rb'
- 'spec/support/shared_examples/behaves_like_sending_workshop_emails.rb'

# Offense count: 3
# Configuration parameters: Max.
RSpec/MultipleExpectations:
Expand All @@ -236,34 +199,6 @@ RSpec/MultipleExpectations:
- 'spec/features/admin/sponsor_spec.rb'
- 'spec/lib/omniauth/strategies/codebar_spec.rb'

# Offense count: 19
RSpec/StubbedMock:
Exclude:
- 'spec/controllers/admin/members_controller_spec.rb'
- 'spec/controllers/payments_controller_spec.rb'
- 'spec/features/admin/workshops_spec.rb'
- 'spec/features/subscribing_to_newsletter_spec.rb'
- 'spec/lib/services/mailing_list_spec.rb'
- 'spec/lib/tasks/feedback_rake_spec.rb'
- 'spec/lib/tasks/mailing_list_rake_spec.rb'
- 'spec/lib/tasks/reminders_meeting_rake_spec.rb'
- 'spec/lib/tasks/reminders_workshop_rake_spec.rb'
- 'spec/presenters/meeting_presenter_spec.rb'

# Offense count: 38
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
RSpec/VerifiedDoubles:
Exclude:
- 'spec/controllers/admin/member_search_controller_spec.rb'
- 'spec/features/subscribing_to_newsletter_spec.rb'
- 'spec/lib/services/mailing_list_spec.rb'
- 'spec/policies/application_policy_spec.rb'
- 'spec/presenters/event_presenter_spec.rb'
- 'spec/presenters/virtual_workshop_presenter_spec.rb'
- 'spec/presenters/workshop_presenter_spec.rb'



# Offense count: 5
Rails/HasAndBelongsToMany:
Exclude:
Expand Down Expand Up @@ -291,7 +226,6 @@ Rails/HelperInstanceVariable:
Exclude:
- 'app/helpers/email_helper.rb'


# Offense count: 2
# Configuration parameters: IgnoreScopes.
Rails/InverseOf:
Expand Down Expand Up @@ -321,7 +255,6 @@ Rails/SkipsModelValidations:
- 'app/controllers/workshop_invitation_controller.rb'
- 'app/services/invitation_logger.rb'


# Offense count: 8
Rails/UniqueValidationWithoutIndex:
Exclude:
Expand All @@ -332,12 +265,3 @@ Rails/UniqueValidationWithoutIndex:
- 'app/models/meeting_invitation.rb'
- 'app/models/workshop_invitation.rb'
- 'app/models/workshop_sponsor.rb'









2 changes: 1 addition & 1 deletion spec/controllers/admin/member_search_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
end

context 'when an admin user searches and there are multiple results' do
let(:fake_romeo) { double('Member', id: 2, name: 'Romeo', surname: 'Capulet') }
let(:fake_romeo) { instance_double(Member, id: 2, name: 'Romeo', surname: 'Capulet') }

before do
allow(Member).to receive(:find_members_by_name).with('e').and_return(fake_relation)
Expand Down
10 changes: 8 additions & 2 deletions spec/controllers/admin/members_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,14 @@

it 'sends an attendance warning email' do
mailer = double(deliver_now: true)
expect(MemberMailer).to receive(:attendance_warning)
allow(MemberMailer).to receive(:attendance_warning)
.with(member, member.email)
.and_return(mailer)

get :send_attendance_email, params: { member_id: member.id }

expect(MemberMailer).to have_received(:attendance_warning)
.with(member, member.email)
end

it 'redirects to the member page' do
Expand Down Expand Up @@ -126,11 +129,14 @@

it 'sends an eligibility check email' do
mailer = double(deliver_now: true)
expect(MemberMailer).to receive(:eligibility_check)
allow(MemberMailer).to receive(:eligibility_check)
.with(member, member.email)
.and_return(mailer)

get :send_eligibility_email, params: { member_id: member.id }

expect(MemberMailer).to have_received(:eligibility_check)
.with(member, member.email)
end

it 'redirects to the member page' do
Expand Down
7 changes: 6 additions & 1 deletion spec/controllers/payments_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
describe 'POST #create' do
context 'with valid parameters' do
it 'creates a Stripe customer and charge' do
expect(Stripe::Customer).to receive(:create).with(
allow(Stripe::Customer).to receive(:create).with(
email: 'john@example.com',
description: 'John Doe',
source: 'tok_123'
Expand All @@ -25,6 +25,11 @@
}
}
expect(response).to be_successful
expect(Stripe::Customer).to have_received(:create).with(
email: 'john@example.com',
description: 'John Doe',
source: 'tok_123'
)
end
end

Expand Down
6 changes: 4 additions & 2 deletions spec/features/admin/workshops_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,21 +183,23 @@
context 'when sending invitations to attendees' do
scenario 'for a workshop' do
workshop = Fabricate(:workshop)
expect(InvitationManager).to receive(:new).and_return(double.as_null_object)
allow(InvitationManager).to receive(:new).and_return(double.as_null_object)

visit admin_workshop_send_invites_path(workshop)
click_on 'Students'

expect(InvitationManager).to have_received(:new)
expect(page).to have_text('Invitations to students are being emailed out')
end

scenario 'for a virtual workshop' do
workshop = Fabricate(:virtual_workshop)
expect(InvitationManager).to receive(:new).and_return(double.as_null_object)
allow(InvitationManager).to receive(:new).and_return(double.as_null_object)

visit admin_workshop_send_invites_path(workshop)
click_on 'Students'

expect(InvitationManager).to have_received(:new)
expect(page).to have_text('Invitations to students are being emailed out')
end
end
Expand Down
42 changes: 24 additions & 18 deletions spec/features/subscribing_to_newsletter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

context 'when a new member' do
scenario 'is subscribed to the newsletter by default' do
mailing_list = double(:mailing_list)
expect(Services::MailingList).to receive(:new).and_return(mailing_list)
expect(mailing_list).to receive(:subscribe).with('jane@codebar.io', 'Jane', 'Doe')
mailing_list = instance_double(Services::MailingList)
allow(Services::MailingList).to receive(:new).and_return(mailing_list)
allow(mailing_list).to receive(:subscribe).with('jane@codebar.io', 'Jane', 'Doe')

visit new_member_path
click_on 'Join us as a coach'
Expand All @@ -30,12 +30,14 @@
find_by_id('member_how_you_found_us_from_a_friend').click

click_on 'Next'

expect(mailing_list).to have_received(:subscribe).with('jane@codebar.io', 'Jane', 'Doe')
end

scenario 'can opt out of the newsletter' do
mailing_list = double(:mailing_list)
expect(Services::MailingList).to receive(:new).and_return(mailing_list)
expect(mailing_list).to receive(:unsubscribe).with('jane@codebar.io')
mailing_list = instance_double(Services::MailingList)
allow(Services::MailingList).to receive(:new).and_return(mailing_list)
allow(mailing_list).to receive(:unsubscribe).with('jane@codebar.io')

visit new_member_path
click_on 'Join us as a coach'
Expand All @@ -53,6 +55,8 @@
uncheck 'newsletter'

click_on 'Next'

expect(mailing_list).to have_received(:unsubscribe).with('jane@codebar.io')
end
end

Expand All @@ -62,13 +66,14 @@

login member

mailing_list = double(:mailing_list)
expect(Services::MailingList).to receive(:new).and_return(mailing_list)
expect(mailing_list).to receive(:subscribe)
mailing_list = instance_double(Services::MailingList)
allow(Services::MailingList).to receive(:new).and_return(mailing_list)
allow(mailing_list).to receive(:subscribe)

visit subscriptions_path
click_on 'Subscribe to newsletter'

expect(mailing_list).to have_received(:subscribe)
expect(page).to have_text('You have subscribed to codebar\'s newsletter')
end

Expand All @@ -77,13 +82,14 @@

login member

mailing_list = double(:mailing_list)
expect(Services::MailingList).to receive(:new).and_return(mailing_list)
expect(mailing_list).to receive(:unsubscribe)
mailing_list = instance_double(Services::MailingList)
allow(Services::MailingList).to receive(:new).and_return(mailing_list)
allow(mailing_list).to receive(:unsubscribe)

visit subscriptions_path
click_on 'Unsubscribe from newsletter'

expect(mailing_list).to have_received(:unsubscribe)
expect(page).to have_text('You have unsubscribed from codebar\'s newsletter')
end

Expand All @@ -92,20 +98,20 @@

login member

mailing_list = double(:mailing_list)
expect(Services::MailingList).to receive(:new).and_return(mailing_list)
expect(mailing_list).to receive(:subscribe)
mailing_list = instance_double(Services::MailingList)
allow(Services::MailingList).to receive(:new).and_return(mailing_list)
allow(mailing_list).to receive(:subscribe)
allow(mailing_list).to receive(:unsubscribe)

visit subscriptions_path
click_on 'Subscribe to newsletter'

expect(mailing_list).to have_received(:subscribe)
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(mailing_list).to have_received(:unsubscribe)
expect(page).to have_text('You have unsubscribed from codebar\'s newsletter')
end
end
Expand Down
Loading