Prevent loading of Mongoid adapter when reasonable #350
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When I use a version of Ruby and a version of Rails that are not compatible with the use of Monogoid
I want to be able to run the test suite as usual
Even if it means not loading the Mongoid adapter code (because I am not using it anyway)
So that I can contribute to the development or maintenance of a gem that I use
Running the test suite easily (a.k.a running
rake
without parameters) is not optional.With recent versions of Ruby (2.5 for sure) and of Rails (6 for sure), Mongoid doesn't find
ActiveModel::Serializers::Xml
. Because the Mongoid adapter doesrequire 'mongoid'
when the test suite is run, this situation breaks the test suite.I believe anyone using Mongoid would ensure that the version they use is compatible with their version of Rails and Ruby. Because of that, loading the adapter only when that is true seems reasonable.
Why only the
ruby-head
build is failing with Rails 6?Because the other Rails 6 build runs on Ruby 2.2.2, I believe that the versions of Mongoid that is installed is different...?
About the syntax
The condition must be compatible with Ruby 1.9.3.
References