How to use FactoryGirl factories from an engine

前端 未结 1 403
星月不相逢
星月不相逢 2021-01-04 12:12

We have two web apps that share the same database and models. To keep it DRY we created an engine that contains all those models. This engine is included in the respective a

相关标签:
1条回答
  • 2021-01-04 12:30

    Ok so this works: https://github.com/thoughtbot/factory_girl_rails/pull/42

    As it says on that pull request, include that code snippet in your core engine.

    In the core engine you also need to modify your ".gemspec" file to add in the "spec/factories" files:

    s.files = Dir["{app,config,db,lib}/**/*", "spec/factories/**/*", "LICENSE", "Rakefile", "README.md"]
    

    Then those factories will be available in the application that includes your engine.

    0 讨论(0)
提交回复
热议问题