I am using rails console in the development environment and I want to use factories. How can I get access to them?
I have tried require "FactoryBot"
which returns
1.9.3p393 :301 > require "FactoryBot"
LoadError: cannot load such file -- FactoryBot
To solve this problem ensure that the factory bot gem is specifed in your Gemfile similar to this
group :development, :test do
gem 'factory_bot_rails'
end
Then bundle install
.
This should make FactoryBot class available in the development console.
Hope this helps.