Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rails_helper template: Restore old order of support files #2785

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

franzliedke
Copy link
Contributor

Before #2678, the suggested code snippet for loading support files loaded files in directories (e.g. spec/support/a/b.rb) after files with the same basename as those directories (e.g. spec/support/a.rb).

This tends to be the preferrable load order, given how Ruby modules and classes are usually structured.

The root cause is a difference between the alphabetic ordering of string sorting compared to Pathname#<=>.

Before rspec#2678, the suggested code snippet for loading support files loaded files in directories (e.g. `spec/support/a/b.rb`) *after* files with the same basename as those directories (e.g. `spec/support/a.rb`).

This tends to be the preferrable load order, given how Ruby modules and classes are usually structured.

The root cause is a difference between the alphabetic ordering of string sorting compared to `Pathname#<=>`.
@franzliedke
Copy link
Contributor Author

@JonRowe suggested this approach in #2678 (comment).

@franzliedke
Copy link
Contributor Author

Side note: Is there a template for a default spec_helper.rb (for non-Rails projects) somewhere? 🧐

@pirj
Copy link
Member

pirj commented Aug 27, 2024

Is there a template for a default spec_helper.rb

Here you go, @franzliedke.

@franzliedke
Copy link
Contributor Author

Thank you, sir. No equivalent code there, so we're good.

@pirj pirj merged commit 32a4b78 into rspec:main Aug 27, 2024
19 of 22 checks passed
@pirj
Copy link
Member

pirj commented Aug 27, 2024

Thank you!

pirj added a commit that referenced this pull request Aug 27, 2024
JonRowe pushed a commit that referenced this pull request Sep 2, 2024
rails_helper template: Restore old order of support files
JonRowe pushed a commit that referenced this pull request Sep 2, 2024
@JonRowe
Copy link
Member

JonRowe commented Sep 7, 2024

Released in 6.1.5 (and later)

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.

3 participants