Sha256: 4d0ecf13d6956c7806e91ea934e8a82537ec8de32e1b8f0e495ff3e24008f4ea

Contents?: true

Size: 652 Bytes

Versions: 5

Compression:

Stored size: 652 Bytes

Contents

require 'factory_bot'
require 'factory_bot_rails/generator'
require 'rails'

module FactoryBot
  class Railtie < Rails::Railtie

    initializer "factory_bot.set_fixture_replacement" do
      FactoryBotRails::Generator.new(config).run
    end

    initializer "factory_bot.set_factory_paths" do
      FactoryBot.definition_file_paths = [
        Rails.root.join('factories'),
        Rails.root.join('test', 'factories'),
        Rails.root.join('spec', 'factories')
      ]
    end

    config.after_initialize do
      FactoryBot.find_definitions

      if defined?(Spring)
        Spring.after_fork { FactoryBot.reload }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
factory_bot_rails-4.11.1 lib/factory_bot_rails/railtie.rb
factory_bot_rails-4.11.0 lib/factory_bot_rails/railtie.rb
factory_bot_rails-4.10.0 lib/factory_bot_rails/railtie.rb
factory_bot_rails-4.8.2 lib/factory_bot_rails/railtie.rb
factory_bot_rails-1.0.0.alpha lib/factory_bot_rails/railtie.rb