Skip to content

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

Draft
mroderick wants to merge 1 commit into
masterfrom
require-rails-helper-in-specs
Draft

Add missing require 'rails_helper' to spec files#2859
mroderick wants to merge 1 commit 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.
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