Open Schmitze333 opened 3 weeks ago
Adding active_support/inflector
to the requires in factory_bot.rb
solves the problem:
require "set"
require "active_support/core_ext/module/delegation"
require "active_support/core_ext/module/attribute_accessors"
require "active_support/deprecation"
require "active_support/notifications"
require "active_support/inflector"
require "factory_bot/internal"
require "factory_bot/definition_hierarchy"
require "factory_bot/configuration"
require "factory_bot/errors"
...
But it's kind of strange that one has to add a class that is used by activesupport
internally.
Can you add to your gemfile this gem 'activesupport', '< 7.2.1'
Then run: bundle update activesupport
Add the following to the top of your test.rb or spec_helper.rb file: require 'active_support/inflector' require 'factory_bot'
@souadfettah Thank you for the very fast reply ❤️ !
I know how to hot-fix the problem in my projects.
Nevertheless, I think that should be fixed in factory_bot
.
Description
In combination with the latest
activesupport
gem (version 7.2.1) just requiringfactory_bot
resolves in the following error:Reproduction Steps
Gemfile:
Test file:
Running:
ruby test.rb
will result in the above error.But also a typical setup with requiring
factory_bot
in thespec_helper
will fail.Expected behavior
factory_bot
should be able to load.Actual behavior
factory_bot
crashes.System configuration
factory_bot version: 6.4.6 rails version:
ruby version: tested with 3.3.1 and 3.3.4