Skip to content

Commit 88c73b6

Browse files
issyl0Issy Long
andcommitted
Make generated spec/rails_helper.rb file compliant with RuboCop 0.80
- Over in @alphagov, we upgraded to RuboCop 0.80 which includes a new cop - `Lint/NonDeterministicRequireOrder`. This fails when linting this file: ``` spec/rails_helper.rb:20:1: W: Lint/NonDeterministicRequireOrder: Sort files before requiring them. Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 158 files inspected, 1 offense detected ``` - While this is a generated file, [we decided to fix it in our projects anyway](alphagov/contacts-admin@715383a) everywhere we could, and push this fix upstream so that everyone gets it in hopefully a next release of `rspec-rails`. Co-authored-by: Issy Long <[email protected]>
1 parent 2f22bf3 commit 88c73b6

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
@@ -20,7 +20,7 @@
2020
# directory. Alternatively, in the individual `*_spec.rb` files, manually
2121
# require only the support files necessary.
2222
#
23-
# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
23+
# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }
2424

2525
<% if RSpec::Rails::FeatureCheck.has_active_record_migration? -%>
2626
# Checks for pending migrations and applies them before tests are run.

0 commit comments

Comments
 (0)