Skip to content

Load our adapters and extensions first. #1281

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

Merged
merged 1 commit into from
Jan 18, 2015
Merged

Conversation

cupakromer
Copy link
Member

Ensure that our adapters and extensions are early in the load process.
This way we can be sure that all adjustments to the Rails libs are
available when we our code that depends on Rails.

Ensure that our adapters and extensions are early in the load process.
This way we can be sure that all adjustments to the Rails libs are
available when we our code that depends on Rails.
@cupakromer
Copy link
Member Author

This has the side effect of early loading ActiveSupport and ActiveSupport:: Concern. Many of the example groups use these features but do not directly require ActiveSupport. This caused an issue in #1242. However, I do not think this PR needs a Changelog entry because of that (see next paragraph).

Right now we have an implicit expectation that the Rails environment is loaded first. It would be good to consider either aborting the spec run or issuing a warning that the environment is not loaded when require 'rspec/rails' is called. I think that would be a breaking change so it should be a config option if we go that route.

On a related note. Many rspec-rails projects have custom setups where they only load parts of Rails. As it stands now, rspec-rails isn't completely setup to support this. It is something I would like to support down the road, but I feel it would require a significant amount of work. It would also require a good documentation update to explain how loading rspec-rails in isolation will work.

@myronmarston
Copy link
Member

This has the side effect of early loading ActiveSupport and ActiveSupport:: Concern. Many of the example groups use these features but do not directly require ActiveSupport.

My suggestion is to move away from using ActiveSupport::Concern all together. I don't think it's a big enough win to warrant that dependency. Instead, I think that we can use RSpec core shared example groups for the stuff that currently uses ActiveSupport::Concern. Or just plain old modules.

@cupakromer
Copy link
Member Author

I'm fine with moving away from AS::Concern in the long run. We can modify the existing modules to move away from it as a first step. I'd like use to resolve rspec/rspec-core#1749 before moving these to shared example groups.

cupakromer added a commit that referenced this pull request Jan 18, 2015
Load our adapters and extensions first.
@cupakromer cupakromer merged commit b982c23 into master Jan 18, 2015
@cupakromer cupakromer deleted the load-order-update branch January 18, 2015 00:49
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.

2 participants