Upgrading factory_bot 5 to 6
Breaking5.2.0 → 6.6.0Breaking3Security1Platform2New15Changed7Fixed26Other71
BreakingUpgrade verdict
3 breaking changes and 2 platform requirement changes and a security fix.
In plain terms
- Removed: support for EOL versions of Ruby (2.3, 2.4) and Rails (4.2).
- Removed: support for "abstract" factories with no associated class; use traits instead.
- Removed: deprecated methods on the top-level FactoryBot module meant only for internal use.
- The library now requires a newer version of Ruby to install.
Must act Top 5 of 6 that need code or config changes
Ruby requirement changed in 6.4.6: >= 2.3.0 → >= 3.0.0.
What you must change
Breaking3
Removed: support for EOL versions of Ruby (2.3, 2.4) and Rails (4.2).
Removed: support for "abstract" factories with no associated class; use traits instead.
Removed: deprecated methods on the top-level FactoryBot module meant only for internal use.
FactoryBotSecurity1
Requires MFA for gem pushes.
Platform2
Bumps the minimum required Ruby version in the gemspec.
Requires Ruby 3.0+ and Rails 6.1+.
API changes
Generated by DepDelta from published Ruby source. Not mixed with prose notes.
- removed:
static property FactoryBot.allow_class_lookup: accessor - added:
static set FactoryBot.build_stubbed_starting_id(_)
- removed:
class StrategyCalculator - removed:
constructor StrategyCalculator(_) - removed:
method StrategyCalculator.strategy() - removed:
set Evaluator.instance(_) - removed:
static method Internal.register_callback(_) - removed:
static method Internal.register_default_callbacks() - changed:
class Deprecation < ActiveSupport::Deprecation.new("6.0", "factory_bot") → class Deprecation < ActiveSupport::Deprecation.new("7.0", "factory_bot") - changed:
constructor Definition(_, _ = …) → constructor Definition(_, _ = …, **) - changed:
constructor Evaluation(_, _, _) → constructor Evaluation(_, _, _, _) - changed:
constructor Trait(_) → constructor Trait(_, **) - changed:
method Decorator.send(_, *) → method Decorator.send(...) - changed:
method Definition.compile() → method Definition.compile(_ = …) - changed:
method Evaluator.increment_sequence(_) → method Evaluator.increment_sequence(_, scope: …) - changed:
method NullObject.respond_to?(_, _ = …) → method NullObject.respond_to?(_) - changed:
static method Internal.trait_by_name(_) → static method Internal.trait_by_name(_, _) - added:
class Enum - added:
class UriManager - added:
constructor Enum(_, _ = …) - added:
constructor UriManager(*, paths: …) - added:
method Definition.defined_traits_names() - added:
method Definition.register_enum(_) - added:
method DefinitionProxy.traits_for_enum(_, _ = …) - added:
method Enum.build_traits(_) - added:
method Sequence.for_factory?(_) - added:
method Sequence.has_name?(_) - added:
method Sequence.has_uri?(_) - added:
method Sequence.set_value(_) - added:
method Trait.clone() - added:
method UriManager.to_a() - added:
property Definition.klass: accessor - added:
property Definition.registered_enums: reader - added:
property Definition.uri_manager: reader - added:
property Evaluator.instance: accessor - added:
property Sequence.aliases: reader - added:
property Sequence.uri_manager: reader - added:
property Trait.uid: reader - added:
property UriManager.endpoints: reader - added:
property UriManager.paths: reader - added:
property UriManager.uri_list: reader - added:
protected property Sequence.proc: reader - added:
static method Internal.rewind_sequence(*) - added:
static method Internal.set_sequence(*, _) - added:
static method Sequence.find(*) - added:
static method Sequence.find_by_uri(_) - added:
static method Strategy.lookup_strategy(_) - added:
static method UriManager.build_uri(*)
- added:
method EnumeratorAdapter.integer_value?() - added:
method EnumeratorAdapter.set_value(_)
- added:
method AttributesFor.to_sym() - added:
method Build.to_sym() - added:
method Create.to_sym() - added:
method Null.to_sym() - added:
method Stub.to_sym() - added:
static set Stub.next_id(_)
- changed:
method Methods.generate(_) → method Methods.generate(*, scope: …) - changed:
method Methods.generate_list(_, _) → method Methods.generate_list(*, _, scope: …)
- changed:
method DSL.sequence(_, *) → method DSL.sequence(_, ...)