1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot_rails.git synced 2022-11-09 11:49:18 -05:00

Fix definition_file_paths setting for Rails engine

This commit is contained in:
Fumiaki MATSUSHIMA 2019-05-15 15:28:43 +09:00 committed by Daniel Colson
parent 34982c03f1
commit 7e44401667

View file

@ -66,9 +66,14 @@ This will cause factory\_bot\_rails to automatically load factories in
It is possible to use this setting to share factories from a gem:
```rb
begin
require 'factory_bot_rails'
rescue LoadError
end
class MyEngine < ::Rails::Engine
config.factory_bot.definition_file_paths =
File.expand_path('../factories', __FILE__) if defined?(FactoryBotRails)
[File.expand_path('../factories', __FILE__)] if defined?(FactoryBotRails)
end
```