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/factory_girl_rails/railtie.rb
2014-02-12 11:20:36 -05:00

28 lines
661 B
Ruby

require 'factory_girl'
require 'factory_girl_rails/generator'
require 'rails'
module FactoryGirl
class Railtie < Rails::Railtie
initializer "factory_girl.set_fixture_replacement" do
FactoryGirlRails::Generator.new(config).run
end
initializer "factory_girl.set_factory_paths" do
FactoryGirl.definition_file_paths = [
Rails.root.join('factories'),
Rails.root.join('test', 'factories'),
Rails.root.join('spec', 'factories')
]
end
config.after_initialize do
FactoryGirl.find_definitions
if defined?(Spring)
Spring.after_fork { FactoryGirl.reload }
end
end
end
end