rubyatscale / packs-rails

packs-rails establishes and implements a set of conventions for splitting up large monoliths.
MIT License
268 stars 26 forks source link

Fix factory bot integration and add minitest support #71

Closed matiaseche closed 11 months ago

matiaseche commented 11 months ago

Fixes #68.

Trying to make the integration work with Minitest I realized the paths were never added because app.config.respond_to?(:factory_bot) always returned false.

If this is moved in the railtie to a config.after_initialize then it works as expected.

I could not write tests since I didn't find any, I am hoping to get advice on how to do these tests here :wink: What I did was:

bin/rails test some_test.rb # it has a binding.pry
# => Rails.application.config.factory_bot.definition_file_paths
[
    [0] "factories",
    [1] "test/factories",
    [2] "spec/factories"
]

In that list we should also see every pack path + "spec/factories", but it is not there.

With this fix it will work as expected, and it will also support minitest folder structure test/factories.

professor commented 11 months ago

Thanks @matiaseche for the PR.

My team is dedicating two working sessions each week to review open PRs. We've been using a two-prong approach to tackle the newest open PRs and the oldest open PRs during each session.