Sha256: 996ad6338f9dc7e89fb01a160fed469e98125b6623312a365aaffef65bc87ec8
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
require 'factory_girl' require 'rails' module FactoryGirl class Railtie < Rails::Railtie initializer "factory_girl.set_fixture_replacement" do generators = config.respond_to?(:app_generators) ? config.app_generators : config.generators rails_options = generators.options[:rails] if rails_options[:test_framework] == :rspec factory_girl_dir = generators.options.fetch(:factory_girl, { :dir => 'spec/factories' })[:dir] if rails_options.has_key?(:fixture_replacement) generators.fixture_replacement rails_options[:fixture_replacement], :dir => factory_girl_dir else generators.fixture_replacement :factory_girl, :dir => factory_girl_dir end else generators.test_framework rails_options[:test_framework], :fixture => false, :fixture_replacement => :factory_girl end 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
factory_girl_rails-4.2.1 | lib/factory_girl_rails/railtie.rb |