Sha256: f6d03bcc690e4e331f4427330fe33566d92cde1b5f90a296bd2a972fb6a8e597

Contents?: true

Size: 647 Bytes

Versions: 8

Compression:

Stored size: 647 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

8 entries across 8 versions & 1 rubygems

Version Path
factory_bot_rails-5.2.0 lib/factory_bot_rails/generators/rspec_generator.rb
factory_bot_rails-5.1.1 lib/factory_bot_rails/generators/rspec_generator.rb
factory_bot_rails-5.1.0 lib/factory_bot_rails/generators/rspec_generator.rb
factory_bot_rails-5.0.2 lib/factory_bot_rails/generators/rspec_generator.rb
factory_bot_rails-5.0.1 lib/factory_bot_rails/generators/rspec_generator.rb
factory_bot_rails-5.0.0 lib/factory_bot_rails/generators/rspec_generator.rb
factory_bot_rails-5.0.0.rc2 lib/factory_bot_rails/generators/rspec_generator.rb
factory_bot_rails-5.0.0.rc1 lib/factory_bot_rails/generators/rspec_generator.rb