Sha256: 9b6b71666b6a5430dc4c96b15dc310f5ffb8503eb01054d67584cb37ec3f2843

Contents?: true

Size: 791 Bytes

Versions: 18

Compression:

Stored size: 791 Bytes

Contents

require "factory_bot_rails/generators/rspec_generator"
require "factory_bot_rails/generators/non_rspec_generator"
require "factory_bot_rails/generators/null_generator"

module FactoryBotRails
  class Generator
    def initialize(config)
      @generators = config.app_generators
    end

    def run
      generator.new(@generators).run
    end

    def generator
      return Generators::NullGenerator if factory_bot_disabled?

      if test_framework == :rspec
        Generators::RSpecGenerator
      else
        Generators::NonRSpecGenerator
      end
    end

    def test_framework
      rails_options[:test_framework]
    end

    def factory_bot_disabled?
      rails_options[:factory_bot] == false
    end

    def rails_options
      @generators.options[:rails]
    end
  end
end

Version data entries

18 entries across 17 versions & 2 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/factory_bot_rails-6.4.4/lib/factory_bot_rails/generator.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/factory_bot_rails-6.4.4/lib/factory_bot_rails/generator.rb
factory_bot_rails-6.4.4 lib/factory_bot_rails/generator.rb
factory_bot_rails-6.4.3 lib/factory_bot_rails/generator.rb
factory_bot_rails-6.4.2 lib/factory_bot_rails/generator.rb
factory_bot_rails-6.4.0 lib/factory_bot_rails/generator.rb
factory_bot_rails-6.3.0 lib/factory_bot_rails/generator.rb
factory_bot_rails-6.2.0 lib/factory_bot_rails/generator.rb
factory_bot_rails-6.1.0 lib/factory_bot_rails/generator.rb
factory_bot_rails-6.0.0 lib/factory_bot_rails/generator.rb
factory_bot_rails-5.2.0 lib/factory_bot_rails/generator.rb
factory_bot_rails-5.1.1 lib/factory_bot_rails/generator.rb
factory_bot_rails-5.1.0 lib/factory_bot_rails/generator.rb
factory_bot_rails-5.0.2 lib/factory_bot_rails/generator.rb
factory_bot_rails-5.0.1 lib/factory_bot_rails/generator.rb
factory_bot_rails-5.0.0 lib/factory_bot_rails/generator.rb
factory_bot_rails-5.0.0.rc2 lib/factory_bot_rails/generator.rb
factory_bot_rails-5.0.0.rc1 lib/factory_bot_rails/generator.rb