Hello,
our tests are failing with factory_bot v6.0.0
uninitialized constant FactoryBot::Decorator::NewConstructor::NoMethodError
We're using https://github.com/ErwinM/acts_as_tenant that can be a reason.
Revert of https://github.com/thoughtbot/factory_bot/commit/df5471078ce1fd45f094ad77c892ee9657d13c92 solves a problem, but seems like a hack
Repo with test script https://github.com/artplan1/factory-bot-repro
Failing test https://github.com/artplan1/factory-bot-repro/runs/787838379?check_suite_focus=true
NoMethodError to be defined
NoMethodError is unitialized
factory_bot version: 6.0.0
rails version: 6.0.3.2
ruby version: 2.6.5
Thanks for the issue, and for tracking down the commit that introduced it. Let's revert https://github.com/thoughtbot/factory_bot/commit/df5471078ce1fd45f094ad77c892ee9657d13c92. Ideally we would also get a test to cover this behavior so we don't accidentally change it again.
I don't fully understand how to write a test without acts_as_tenant, but for what it is worth we hit https://github.com/rails/rails/blob/master/activesupport/lib/active_support/dependencies.rb#L211-L214 along the way to this error.
Reverted in 4b06427
factory_bot 6.0.1 is out. Could you confirm that this release fixes the problem you were having?
yes, tests are green on 6.0.1.
Thank you for the quick fix