FactoryBot.modify does not override gem factory
Author: Set27Created May 8, 2025Updated Jun 3, 2026
Labelsbug
Description
I tried to get all factories from spree gem, but overriding some of the factories, in this case user factories.
I add it them using require 'spree/testing_support/factories' in spec_helper.rb.
But
Using FactoryBot.modify I get
Factory not registered: "user"Using FactoryBot.define I get
Factory already registered: userReproduction Steps
https://github.com/Set27/factory_bot_overriding_issue
System configuration
factory_bot 6.5.1
rails 7.2.2.1
ruby 3.3.4
Source: thoughtbot/factory_bot