Skip to content

Commit a73ef24

Browse files
authored
rails_helper template: Restore old order of support files
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#<=>`.
1 parent d0e322b commit a73ef24

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/generators/rspec/install/templates/spec/rails_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# directory. Alternatively, in the individual `*_spec.rb` files, manually
2626
# require only the support files necessary.
2727
#
28-
# Rails.root.glob('spec/support/**/*.rb').sort.each { |f| require f }
28+
# Rails.root.glob('spec/support/**/*.rb').sort_by(&:to_s).each { |f| require f }
2929
3030
<% if RSpec::Rails::FeatureCheck.has_active_record_migration? -%>
3131
# Checks for pending migrations and applies them before tests are run.

0 commit comments

Comments
 (0)