Skip to content
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

Prevent loading of Mongoid adapter when reasonable #350

Merged

Conversation

gonzalo-bulnes
Copy link
Owner

@gonzalo-bulnes gonzalo-bulnes commented Aug 20, 2019

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 does require '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

Mongoid will be loaded when loading the apdapter code,
there is no point in requiring it in the spec_helper.
Unless I'm wrong, no version of Mongoid is currently compatible with Rails 6.

As far as I know at the time of writing, the XML serializer requirement
is currently unmet, and I think it is a reasonable flag to use in order
to load the adpater only when usable.

Note: the syntax of the condition must be compatible with Ruby 1.9.3
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.

None yet

1 participant