Skip to content

Conversation

@pranav-g10
Copy link
Contributor

Make rake task namespace to configurable so conflict with ActiveRecord rake tasks can be avoided

Copy link
Collaborator

@jarthod jarthod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this MR, I like the idea, a couple comments

class TestCase < Minitest::Test #:nodoc:

def setup
Mongoid::Migrator.migrations_path = ["db/migrate"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for?

assert_equal ["db/mongoid"], Mongoid::Migrator.migrations_path
Mongoid::Migrator.migrations_path += ["engines/my_engine/db/migrate"]
assert_equal ["db/mongoid", "engines/my_engine/db/migrate"], Mongoid::Migrator.migrations_path
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really testing the namespacing of tasks ^^

Copy link
Contributor Author

@pranav-g10 pranav-g10 Mar 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't but practically speaking if one really wants to de-conflict with ActiveRecord they should be modifying both the namespace and the path. Coz if the actual migration files of AR and Mongo live in the same path the rake tasks will still fail. Hence I tested both in the same test case.

Speaking it out loud, this caveat should be mentioned in the README file too

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, no problem with that, what I mean is that the namespacing itself is not tested, if you remove all the changes in database.rake this spec still pass isn't it? I'm not sure if it's easy to do so but I think we should verify the list of rake tasks generated, that their name is correct.

@jgandt-wp
Copy link

Thanks so much! This would close #59

@jarthod
Copy link
Collaborator

jarthod commented Aug 30, 2022

@jgandt-wp Indeed, if you like this approach too, feel free to continue this MR (it's mostly missing specs AFAICS).

@jarthod jarthod force-pushed the master branch 2 times, most recently from f4509bc to 3bb749d Compare November 19, 2024 10:32
@heitor-s
Copy link

heitor-s commented Dec 2, 2024

This PR addresses both #59 and #24 but appears to be unmaintained. I can complete it if that’s not an issue.

@jarthod
Copy link
Collaborator

jarthod commented Dec 3, 2024

@heitor-s indeed nobody finished it yet, feel free to continue and submit it (with specs 🙏)

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.

4 participants