-
Notifications
You must be signed in to change notification settings - Fork 16
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
Don't automatically require rails_helper #11352
Conversation
Generated by 🚫 Danger |
Code Climate has analyzed commit fbc7ec1 and detected 0 issues on this pull request. View more on Code Climate. |
0a10bd5
to
fa9b386
Compare
**Why**: Our "rails_helper" file contains a lot of intensive work that heavily slows down tests. By automatically requiring this file in `.rspec`, it unnecessarily slows down tests that don't need it. As an example, none of our specs in `mappers` require `rails_helper`. When we run specs the old way, the specs run in 16.77 seconds. When we stop requiring `rails_helper`, they run in 0.03745 seconds. That's 448x faster! The recommended best practice is to only require `rails_helper` when it is needed. The next step is to break down the different parts of `rails_helper` into separate files in `spec/support` so that we can further speed up tests. For example, some of the setup in `rails_helper` only applies to feature specs.
fa9b386
to
d05b933
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm cool with this change, though I'm not sure about the focus: true
warning, which I assume is why the CI tests fail to finish.
I don't think it's related. The specs passed earlier. Danger is complaining because |
Why: Our "rails_helper" file contains a lot of intensive work that
heavily slows down tests. By automatically requiring this file in
.rspec
, it unnecessarily slows down tests that don't need it.As an example, none of our specs in
mappers
requirerails_helper
.When we run specs the old way, the specs run in 16.77 seconds. When we
stop requiring
rails_helper
, they run in 0.03745 seconds. That's448x faster!
The recommended best practice is to only require
rails_helper
whenit is needed. The next step is to break down the different parts of
rails_helper
into separate files inspec/support
so that we canfurther speed up tests. For example, some of the setup in
rails_helper
only applies to feature specs.