Sha256: 95226ddb860fac99856b8f9949e26d2f8af8c07f215fbe9d6a1d3322b922ed55

Contents?: true

Size: 646 Bytes

Versions: 10

Compression:

Stored size: 646 Bytes

Contents

module FactoryBotRails
  module Generators
    class RSpecGenerator
      def initialize(generators)
        @generators = generators
      end

      def run
        @generators.fixture_replacement(
          fixture_replacement_setting,
          dir: factory_bot_directory
        )
      end

      private

      def fixture_replacement_setting
        @generators.options[:rails][:fixture_replacement] || :factory_bot
      end

      def factory_bot_directory
        factory_bot_options.fetch(:dir, "spec/factories")
      end

      def factory_bot_options
        @generators.options.fetch(:factory_bot, {})
      end
    end
  end
end

Version data entries

10 entries across 9 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/generators/rspec_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/generators/rspec_generator.rb
factory_bot_rails-6.4.4 lib/factory_bot_rails/generators/rspec_generator.rb
factory_bot_rails-6.4.3 lib/factory_bot_rails/generators/rspec_generator.rb
factory_bot_rails-6.4.2 lib/factory_bot_rails/generators/rspec_generator.rb
factory_bot_rails-6.4.0 lib/factory_bot_rails/generators/rspec_generator.rb
factory_bot_rails-6.3.0 lib/factory_bot_rails/generators/rspec_generator.rb
factory_bot_rails-6.2.0 lib/factory_bot_rails/generators/rspec_generator.rb
factory_bot_rails-6.1.0 lib/factory_bot_rails/generators/rspec_generator.rb
factory_bot_rails-6.0.0 lib/factory_bot_rails/generators/rspec_generator.rb