Thursday, June 04, 2026 1:51:06 AM
> forge_helper.rb.tt
# frozen_string_literal: true

##########################################
# Framework Integration
##########################################

## Rails Integration
# require_relative "../config/environment"

## RSpec Integration (includes your existing configurations)
# require_relative "../spec/spec_helper"

## Custom requires (models, libraries, etc)
# Dir[File.join(__dir__, "..", "lib", "**", "*.rb")].sort.each { |f| require f }

##########################################
# Configuration
##########################################

SpecForge.configure do |config|
  # Base URL for all requests
  config.base_url = "http://localhost:3000"

  ## Global variables (available in all blueprints via {{ variable_name }})
  ## Use for shared values like auth tokens, API versions, etc.
  # config.global_variables = {
  #   api_version: "v1",
  #   auth_header: "Bearer #{ENV['API_TOKEN']}"
  # }

  ## Factory configuration
  # config.factories.auto_discover = false        # Default: true
  # config.factories.paths += ["lib/factories"]   # Adds to default paths

  ## Debug configuration
  # Triggers when debug: true is set on a step
  # config.on_debug { binding.pry }

  ## Callbacks and Hooks
  # Register reusable callbacks for use with `call:` in blueprints or lifecycle hooks

  ## Basic callback registration
  # config.register_callback(:seed_database) do |context|
  #   User.create!(email: "[email protected]")
  # end

  ## With arguments
  # config.register_callback(:create_records) do |context, count:, type:|
  #   count.times { type.constantize.create! }
  # end

  ## Complete example: Database cleanup
  # config.register_callback(:cleanup_db) do |context|
  #   DatabaseCleaner.clean
  # end
  # 
  # config.after(:forge, :cleanup_db)  # Runs once after all tests

  ## Hooks can also be defined directly (useful for simple one-off hooks)
  # config.after(:step) do |context|
  #   next unless context.step.request?
  #
  #   request = context.variables[:request]
  #   puts "→ #{request[:http_verb]} #{request[:url]}"
  # end

  ## Test Framework Configuration
  # config.rspec.formatter = :documentation
end
All opinions represented herein are my own
- © 2024 - 2026 itsthedevman
- build 4294fb2