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:
parent
34982c03f1
commit
7e44401667
1 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue