Created
August 23, 2023 10:59
-
-
Save bassemawhoob/931c2619a68cd3affc019f34731dbdbd to your computer and use it in GitHub Desktop.
Using FactoryBot in Rails console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: https://stackoverflow.com/questions/18195851/how-do-i-use-factories-from-factorybot-in-rails-console | |
require 'factory_bot' | |
# P.S. For fabrication gem you can load the definitions in the rails console with: | |
# Fabrication.manager.load_definitions | |
FactoryBot.find_definitions | |
include FactoryBot::Syntax::Methods |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment