Skip to content

Add missing require 'rails_helper' to spec files - #2859

Merged
mroderick merged 2 commits into
masterfrom
require-rails-helper-in-specs
Sep 10, 2026
Merged

Add missing require 'rails_helper' to spec files#2859
mroderick merged 2 commits into
masterfrom
require-rails-helper-in-specs

Conversation

@mroderick

Copy link
Copy Markdown
Collaborator

Summary

Adds require 'rails_helper' to the 135 spec files that were missing it. Single-file runs previously depended on an implicit load chain: .rspec requires spec_helper, and spec/spec_helper.rb requires config/environment. That line could disappear during a refactor and break every spec run individually.

  • 135 of 160 spec files affected, mostly under spec/models/, spec/services/, and spec/presenters/
  • Change is mechanical: prepend require 'rails_helper' plus a blank line, nothing else

Suggested by @olleolleolle in a review comment on #2846. Fixes #2858.

Review notes

  • Diff is wide but uniform — spot-checking any file shows the full change
  • Files that already had the require line are untouched

135 of 160 spec files did not require rails_helper. They only worked
because .rspec requires spec_helper, and spec_helper requires
config/environment. Running such a file alone depended on that implicit
load chain.

Prepend require 'rails_helper' to each affected file so single-file runs
are self-contained. Suggested by @olleolleolle in a review comment on
#2846. Fixes #2858.
…r-in-specs

* origin/master:
  chore(deps): bump the ruby-deps group across 1 directory with 4 updates
  Pin json gem to ~> 2.3
  Fix flaky add-all-chapters feature spec
  chore: enable RSpecRails/InferredSpecType and drop redundant spec types

# Conflicts:
#	spec/controllers/admin/chapters_controller_spec.rb
#	spec/controllers/admin/events_controller_spec.rb
#	spec/controllers/admin/invitations_controller_spec.rb
#	spec/controllers/admin/member_notes_controller_spec.rb
#	spec/controllers/admin/member_search_controller_spec.rb
#	spec/controllers/admin/sponsors_controller_spec.rb
#	spec/controllers/admin/workshops_controller_spec.rb
#	spec/controllers/workshop_invitation_controller_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/workshops_spec.rb
#	spec/features/chapter_spec.rb
#	spec/features/coach_accepting_invitation_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/managing_workshop_attendance_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/sponsors_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/helpers/email_header_helper_spec.rb
@mroderick
mroderick marked this pull request as ready for review September 10, 2026 10:56
@mroderick
mroderick merged commit 4f7df01 into master Sep 10, 2026
9 checks passed
@mroderick
mroderick deleted the require-rails-helper-in-specs branch September 10, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add require 'rails_helper' to spec files missing it

1 participant