Sha256: 66c1fbc3b8d37cc7c943b59b5d791479e15af628900d887e19ed3b0d43a6e6ac

Contents?: true

Size: 677 Bytes

Versions: 4

Compression:

Stored size: 677 Bytes

Contents

require "rails/generators"

module Suspenders
  class FactoriesGenerator < Rails::Generators::Base
    source_root File.expand_path(
      File.join("..", "..", "..", "templates"),
      File.dirname(__FILE__),
    )

    def add_factory_bot
      gem "factory_bot_rails", group: %i(development test)
      Bundler.with_clean_env { run "bundle install" }
    end

    def set_up_factory_bot_for_rspec
      copy_file "factory_bot_rspec.rb", "spec/support/factory_bot.rb"
    end

    def generate_empty_factories_file
      copy_file "factories.rb", "spec/factories.rb"
    end

    def provide_dev_prime_task
      copy_file "dev.rake", "lib/tasks/dev.rake"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
suspenders-1.50.0 lib/suspenders/generators/factories_generator.rb
suspenders-1.49.0 lib/suspenders/generators/factories_generator.rb
suspenders-1.48.0 lib/suspenders/generators/factories_generator.rb
suspenders-1.47.0 lib/suspenders/generators/factories_generator.rb