1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot_rails.git synced 2022-11-09 11:49:18 -05:00
thoughtbot--factory_bot_rails/lib
Artem Ignatyev 191ce5e47e Tweaked factory_girls_initialization process to allow other engines to advertise its factories for use in a recipient project
When a (mountable) engine defines models and factories to test the models, sometimes it is convenient to use this factories
from a project which depends on the engine.

But current factory_girl_rail initialization processes do not allow to do so without hacks.
(after_initializer resets all FactoryGirl.definition_file_paths to defaults with = [paths])

When this change introduces the engine can advertise some factories in an its own railtie, i.e.:

module ModelCore
  class Engine < Rails::Engine

    initializer "model_core.factories", :after => "factory_girl.set_factory_paths" do
      FactoryGirl.definition_file_paths << File.expand_path('../../../spec/factories', __FILE__) if defined?(FactoryGirl)
    end
  end
end
2011-12-02 11:23:51 -06:00
..
factory_girl_rails Tweaked factory_girls_initialization process to allow other engines to advertise its factories for use in a recipient project 2011-12-02 11:23:51 -06:00
generators Correct whitespace generated by factory template. 2011-10-14 10:36:05 -04:00
factory_girl_rails.rb Added Rails 3 integration 2010-06-09 11:42:48 -04:00