-
-
Notifications
You must be signed in to change notification settings - Fork 1k
split spec bootstapping into separate files #1719
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
Conversation
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.
If this helps spec up working on rspec-rails I'm all for it but theres a few project stylistic issues to work through and one major point about requiring rspec/rails
@@ -1,3 +1,2 @@ | |||
--warnings | |||
--color | |||
--require spec_helper |
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.
Please add this back, it's our project standard to require this here and not in spec files.
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.
Fair enough - the point was really to be explicit about which bootstrapper is used for a given spec.
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.
Our convention is that spec_helper
contains the bare minimum required to configure the spec suite and everything else assumes its presence
# Generators are not automatically loaded by Rails | ||
require 'generators/rspec/controller/controller_generator' | ||
require 'support/generators' | ||
|
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.
Please remove the excess whitespace introduced here and in similar places
@@ -1,4 +1,4 @@ | |||
require "spec_helper" | |||
require 'spec_helper' |
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.
This can be removed as spec_helper
should be required by .rspec
otherwise please don't change our quotes we don't standardise them and would prefer less git churn.
end | ||
I18n.enforce_available_locales = true if I18n.respond_to?(:enforce_available_locales) | ||
|
||
require 'rspec/support/spec' | ||
require 'rspec/rails' |
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.
Theres no point splitting the helpers if you leave this here.
Changes done |
Does this run locally for you? Seems to be failing significantly on CI |
I get two failures from |
If you check the build at least one spec is failing due to not having the correct things loaded |
Which build? |
Travis, see "Details" on the failure on this PR |
This one seems to be failing due to a missing constant - so should have https://travis-ci.org/rspec/rspec-rails/jobs/165104825
A few of the other builds are failing due to dependency incompatibilities - which is not related to this PR since it does not touch the gemspec. https://travis-ci.org/rspec/rspec-rails/jobs/165104820
|
Is the current master passing on Travis? |
Bar the dependency issues which are being resolved in #1713 (hopefully) |
I'm going to try to run the builds locally and track down any remaining issues and will author a new PR |
Hm, would prefer you kept it to this PR... we regularly triage builds until they pass in PRs, better to keep the discussion in one place. |
Ok |
If you fix the non dependancy related failures I'll probably merge this |
You might need to run each spec file individually to find which ones are broken, we do this during the Travis build to ensure there aren't load order dependencies which we've missed, which I think is the case here. |
Ok will do when I have time. |
No rush :) If you rebase off master you should find the dependency build failures go away too |
This PR still looks pretty good to a casual observer like me. @maxcal do you think you could rebase it on the current master and see how that goes? |
Closing as stale for now, if theres any interest in this let me know and I'll reopen |
This splits the spec bootstrapping process into spec_helper.rb, rails_helper.rb and generator_helper.rb to avoid loading the entire rails stack when not needed.
I mostly picked the low hanging fruit - further optimizations could likely be gained by only loading the needed parts of the rails stack with
config.include_context
and loading files explicitly from spec/support.