Sha256: 73bfda5bd5ef2a7d4dfbb530ff13679f75a331abf42b4a708c335c582760d02b

Contents?: true

Size: 877 Bytes

Versions: 23

Compression:

Stored size: 877 Bytes

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

      if generators.options[:rails][:test_framework] == :rspec
        generators.fixture_replacement :factory_girl, :dir => 'spec/factories'
      else
        generators.test_framework :test_unit, :fixture => false, :fixture_replacement => :factory_girl
      end
    end

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

    config.after_initialize do
      FactoryGirl.find_definitions
    end
  end
end

Version data entries

23 entries across 23 versions & 3 rubygems

Version Path
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/factory_girl_rails-4.1.0/lib/factory_girl_rails/railtie.rb
factory_girl_rails-4.1.0 lib/factory_girl_rails/railtie.rb
factory_girl_rails-4.0.0 lib/factory_girl_rails/railtie.rb
factory_girl_rails-4.0.0.rc1 lib/factory_girl_rails/railtie.rb
factory_girl_rails-3.6.0 lib/factory_girl_rails/railtie.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/factory_girl_rails-3.2.0/lib/factory_girl_rails/railtie.rb
factory_girl_rails-3.5.0 lib/factory_girl_rails/railtie.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/factory_girl_rails-3.2.0/lib/factory_girl_rails/railtie.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/factory_girl_rails-3.2.0/lib/factory_girl_rails/railtie.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/factory_girl_rails-3.2.0/lib/factory_girl_rails/railtie.rb
rails-uploader-0.0.4 vendor/bundle/ruby/1.9.1/gems/factory_girl_rails-3.2.0/lib/factory_girl_rails/railtie.rb
factory_girl_rails-3.4.0 lib/factory_girl_rails/railtie.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/factory_girl_rails-3.2.0/lib/factory_girl_rails/railtie.rb
rails-uploader-0.0.1 vendor/bundle/ruby/1.9.1/gems/factory_girl_rails-3.2.0/lib/factory_girl_rails/railtie.rb
factory_girl_rails-3.3.0 lib/factory_girl_rails/railtie.rb
factory_girl_rails-3.2.0 lib/factory_girl_rails/railtie.rb
factory_girl_rails-3.1.0 lib/factory_girl_rails/railtie.rb
factory_girl_rails-3.0.0 lib/factory_girl_rails/railtie.rb
factory_girl_rails-2.0.0 lib/factory_girl_rails/railtie.rb
factory_girl_rails-2.0.0.rc lib/factory_girl_rails/railtie.rb