### Install Database Cleaner Sequel Gem Source: https://github.com/databasecleaner/database_cleaner-sequel/blob/main/README.md Add the database_cleaner-sequel gem to your Gemfile for use in the test environment. ```ruby # Gemfile group :test do gem 'database_cleaner-sequel' end ``` -------------------------------- ### Configure Database Cleaner with Sequel Source: https://github.com/databasecleaner/database_cleaner-sequel/blob/main/README.md Set up Database Cleaner to use the Sequel adapter with a specific strategy (e.g., transaction) and integrate it with Minitest for automatic cleaning before and after tests. ```ruby DatabaseCleaner[:sequel].strategy = :transaction class Minitest::Spec before :each do DatabaseCleaner[:sequel].start end after :each do DatabaseCleaner[:sequel].clean end end ``` -------------------------------- ### Database Cleaner Sequel Strategy Configuration Source: https://github.com/databasecleaner/database_cleaner-sequel/blob/main/README.md Configure the truncation or deletion strategies for Database Cleaner with Sequel, specifying which tables to include or exclude. ```ruby # Only truncate the "users" table. DatabaseCleaner[:sequel].strategy = :truncation, only: ["users"] # Delete all tables except the "users" table. DatabaseCleaner[:sequel].strategy = :deletion, except: ["users"] ``` -------------------------------- ### Database Cleaner Sequel API Source: https://github.com/databasecleaner/database_cleaner-sequel/blob/main/README.md Provides methods for configuring and managing database cleaning operations with the Sequel adapter. ```APIDOC DatabaseCleaner[:sequel] - Selects the Sequel adapter for database cleaning. .strategy = strategy_name, options = {} - Sets the cleaning strategy. Supported strategies: :transaction, :truncation, :deletion. - Options for :truncation and :deletion: - :only (Array): List of table names to include. - :except (Array): List of table names to exclude. - :pre_count (Boolean): If true, checks table row counts before cleaning (defaults to false). .start - Starts the database cleaning process for the current strategy. .clean - Cleans the database according to the configured strategy. .db = db_connection_or_symbol - Sets the Sequel database connection object or symbol (e.g., :default). - Can be specified with a specific database key: DatabaseCleaner[:sequel, db: :my_db_key] ``` -------------------------------- ### Database Cleaner Sequel Adapter Configuration Source: https://github.com/databasecleaner/database_cleaner-sequel/blob/main/README.md Configure the Sequel adapter for Database Cleaner to use a specific Sequel database connection or the default one. ```ruby # Sequel connection object DatabaseCleaner[:sequel].db = Sequel.connect(uri) # Back to default: DatabaseCleaner[:sequel].db = :default # Multiple Sequel databases can be specified: DatabaseCleaner[:sequel, db: :default] DatabaseCleaner[:sequel, db: Sequel.connect(uri)] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.