New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading FG into Rails console #638
Comments
@bbozo Can you try |
Closing due to inactivity; @bbozo if you have any more context or are still running into this, don't hesitate to reopen. Thanks! |
Running into the same issue now. require 'factory_bot_rails'
FactoryBot.definition_file_paths = [
File.join(Gem::Specification.find_by_name('alchemy_cms').gem_dir, 'lib', 'alchemy', 'test_support', 'factories'),
Rails.root.join('spec', 'factories')
]
FactoryBot.factories.clear
FactoryBot.find_definitions
# or FactoryBot.reload This results into the with
with
PS: You might also want to know that this old issue lead to a popular stackoverflow thread. |
Loading/reloading factories from Pry under Rails 4.1 with recent versions of FG results in a warning and
FactoryGirl::DuplicateDefinitionError
exception:Wrapping the sequence-generating code into a simple rescue block resolves the issue for factories (afaik not sequences too):
Gemfile.lock
snippet:Is there an alternate way to reload factories from the console? I guess many people use this process for stubbing default values into the DB/seeding etc and I use it to test factories
The text was updated successfully, but these errors were encountered: