DatabaseCleaner/database_cleaner
62.2
Adequate · 19 September 2026
518
lines of production code
Ruby
primary language
1
measurement over time
What this system is
This system is a Ruby gem library designed to manage database state isolation during automated testing. It provides a modular architecture that separates core cleaning strategies from specific ORM and database adapters, supporting backends such as ActiveRecord, Redis, and Trilogy. The library enables developers to configure and execute various cleaning methods like transaction rollback, truncation, and deletion across single or multiple database connections.
How it got here
2009 — Modular architecture and multi-ORM support
10 changes.
The project underwent a significant architectural restructuring by splitting the gem into a core component and separate adapter metagems to enable modular dependency management. This period also focused on expanding functionality to support multiple Object-Relational Mappers and databases, introducing a Cleaner abstraction and production safeguards to ensure robust isolation across complex testing environments.
2010–2016 — Example suite modernization and test coverage
5 changes.
This period focused on modernizing the examples library by adding support for multi-database and Redis configurations while refactoring Cucumber step definitions to use RSpec 3 syntax. Concurrently, obsolete test infrastructure was removed and comprehensive RSpec test suites were added to ensure robust coverage of core database cleaning components.
2018 — Test infrastructure and setup automation
4 changes.
This period focused on establishing robust testing infrastructure by adding support helpers for multiple ORMs and database configurations. It also introduced a bin/setup script to streamline initial environment configuration and ensure consistent starting states for development.
Features
Added automated setup script
A new \bin/setup\ script has been introduced to streamline the initial environment configuration. This script automatically checks for and installs Ruby dependencies via Bundler and copies a sample configuration file to the active configuration location, ensuring a consistent starting state for the application.
bin · high confidence
Added example configuration files for ActiveRecord and Redis
The examples/config directory now includes database.yml.example and redis.yml to provide reference configurations for testing. The database example defines two SQLite3 database connections (activerecord\_one and activerecord\_two), while the Redis example specifies three distinct Redis instances (test, one, and two) on localhost port 6379.
examples/config · high confidence
Added example scenarios for multiple databases and ORMs
New Cucumber feature files have been added to the examples directory to demonstrate and validate DatabaseCleaner behavior across multiple databases and multiple Object-Relational Mappers (ORMs). These examples allow users to see how the cleaner handles scenarios where widgets are created in different databases or ORM contexts, ensuring the database state is managed correctly in complex setups.
examples/features · high confidence
Added multi-database and Redis example models
The examples library now includes support for testing multiple database connections and Redis integration. New files define ActiveRecord models that can connect to separate SQLite databases (activerecord\_one.db and activerecord\_two.db) to facilitate multi-ORM testing, and introduce Redis-based models (RedisWidget) that utilize the Redis gem for data persistence, including specific variants for connecting to different Redis instances via environment variables.
examples/lib · high confidence
New step definitions for multi-ORM and multi-database database cleaning scenarios
Added a new step definition file that enables Cucumber scenarios to test database cleaning strategies across multiple Object-Relational Mappers (ORMs) and databases. The steps allow users to specify combinations of ORMs (currently supporting ActiveRecord and Redis) and cleaning strategies, then execute example applications to verify that the database is properly cleaned in single, multiple-database, and multi-ORM configurations.
_features/step\definitions · high confidence
Removals
Removed obsolete database cleaner step definition
The file previously located at features/steps/database\_cleaner\_steps.rb has been removed and replaced by a placeholder file named sqlite\_databases\_go\_here in the examples/db directory. This change eliminates the Ruby step definition file that was likely used for database cleaning in tests, replacing it with a marker file intended to indicate where SQLite database files should be stored, effectively removing the associated test infrastructure code.
examples/db · high confidence
Architecture
Split gem into core and metagem components
The library has been restructured by splitting the gem into a 'database\_cleaner-core' component and a 'database\_cleaner' metagem. The new core module is exposed via lib/database\_cleaner-core.rb, while the main library entry point now explicitly requires the ActiveRecord adapter, indicating a shift towards modular dependency management where the core functionality is separated from specific ORM integrations.
lib · high confidence
Behavioural changes
Configurable example feature environment for multiple ORMs and strategies
The example feature support environment now dynamically configures DatabaseCleaner based on environment variables (ORM, ANOTHER\_ORM, STRATEGY, MULTIPLE\_DBS), allowing users to run end-to-end tests against specific ORM adapters (such as ActiveRecord, Redis, Neo4j, MongoMapper, and CouchPotato) with different cleaning strategies (transaction, truncation, or default). This change enables validation of the end-to-end UX for various ORM combinations and database configurations, including multi-database scenarios, by loading the appropriate model libraries and adapter gems at runtime.
examples/features/support · high confidence
Database Cleaner v2.1.0: Trilogy support and safeguard updates
This release adds support for the Trilogy database driver and updates the safeguard logic to skip conventional sqlite:// URLs, preventing false positives during local testing. The project also migrates its CI badge to GitHub Actions and begins testing with Ruby 3.3. Additionally, the gem structure has been refined to include a \database\_cleaner-core\ metagem, with ORM adapters split into their own repositories, and the RSpec configuration now enforces random test ordering to ensure isolation.
(repo-wide) · high confidence
DatabaseCleaner v2.1.0 introduces Cleaner abstraction and production safeguards
This release updates the library to version 2.1.0, replacing the previous Configuration module with a new Cleaner and Cleaners architecture that manages ORM-specific cleaning instances. It introduces a NullStrategy for scenarios where no cleaning is required and adds a Safeguard system that prevents accidental database operations in production environments or against remote URLs unless explicitly allowed via configuration or environment variables. The Cucumber integration has also been updated to use an Around hook for cleaner lifecycle management.
_lib/database\cleaner · high confidence
Refactored test environment to support RSpec 2 and configurable database strategies
The test support layer has been updated to use RSpec 2 expectations instead of the legacy spec/test/unit assertions, and now integrates SimpleCov and Codecov for coverage reporting when the COVERAGE environment variable is enabled. A new FeatureRunner class has been introduced to manage and execute inner Cucumber tests with configurable ORM and database strategies, ensuring that subsequent runs do not overwrite each other's output and that results merge correctly in CI environments.
features/support · high confidence
Restructured database cleaning features for multiple ORMs and strategies
The feature specifications have been reorganized to support cleaning across multiple Object-Relational Mappers (ORMs) and databases. The previous single feature file was replaced by distinct scenarios for standard cleaning, default strategies, multiple databases, and multiple ORMs. This change explicitly validates that ActiveRecord and Redis adapters work with transaction, truncation, and deletion strategies, and ensures that using multiple ORMs simultaneously results in a clean database state.
features · high confidence
Simplified Cucumber step definitions for end-to-end validation
The example step definitions have been refactored to streamline end-to-end testing. New files for ActiveRecord and Redis adapters provide concrete assertions for widget creation and counting, while a new translation layer delegates generic steps to these specific adapters based on environment variables. This change updates the assertions to use RSpec 3 syntax and removes deprecated Cucumber patterns, ensuring the examples validate the core user experience with the two most popular adapter gems.
_examples/features/step\definitions · high confidence
Test coverage
Added comprehensive test coverage for core database cleaning components; Added test infrastructure for database cleaner adapters; Added test support helpers for ActiveRecord, DataMapper, Sequel, and database configurations; Updated test configuration and added code coverage support.
Dependencies
DatabaseCleaner v2.0.0: Core extraction and adapter decoupling
DatabaseCleaner has been split into a core gem and separate adapter gems, allowing users to install only the database adapters they need (e.g., ActiveRecord, Redis) rather than pulling in all dependencies. The main \database\_cleaner\ gem now depends on \database\_cleaner-active\_record\ (version 2.x), while \database\_cleaner-core\ provides the foundational cleaning strategies. This modular approach reduces installation size and dependency conflicts for projects using specific database backends.
(dependencies) · high confidence
Housekeeping
Added placeholder file in tmp directory
A new .keep file was added to the tmp directory to ensure the directory is tracked by version control.
tmp · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 62.
Lenses
- Code Health 99
- Architecture 69
- Maturity 51
- Readiness 58
- Security 98
- Domain Modelling 100
Changes since last survey
- 300 commits — 274 feature/other, 26 fixes
By area
- (root) — 86 commits
- lib/database_cleaner — 62 commits
- (repo) — 47 commits
- spec/database_cleaner — 41 commits
- adapters/database_cleaner-active_record — 14 commits
- spec/support — 12 commits
- examples/features — 5 commits
- adapters/database_cleaner-couch_potato — 4 commits
- adapters/database_cleaner-mongoid — 4 commits
- adapters/database_cleaner-ohm — 4 commits
- adapters/database_cleaner-mongo_mapper — 3 commits
- features/support — 3 commits
- .github/workflows — 2 commits
- adapters/database_cleaner-data_mapper — 2 commits
- spec/spec_helper.rb — 2 commits
- adapters/database_cleaner-mongo — 1 commit
- adapters/database_cleaner-moped — 1 commit
- adapters/database_cleaner-neo4j — 1 commit
- adapters/database_cleaner-redis — 1 commit
- adapters/database_cleaner-sequel — 1 commit
Notable commits
- fix: Fix MySQL deprecation warnings with Rails 5
- fix: Fix Ruby 2.7 deprecation warnings
- fix: Fix broken links in README
- fix: Fix caching of @table_stats_query
- fix: Fix docs about usage of only and except options
- fix: Fixed readme
- fix: Fixed strategy class lookup (#680)
- fix: Merge branch 'fix-ar-internal-metadata-truncation' of https://github.com/hank-spokeo/database_cleaner into hank-spokeo-fix-ar-internal-metadata-truncation
- fix: Merge branch 'hank-spokeo-fix-ar-internal-metadata-truncation'
- fix: Merge pull request #498 from buehmann/fix/pre_count
- fix: Merge pull request #574 from stanhu/sh-fix-mysql-rails5-deprecation-messages
- fix: Merge pull request #584 from cobot00/fix/typo-in-History.rdoc
- fix: Merge pull request #592 from DatabaseCleaner/fix-adapter-links-in-readme
- fix: Merge pull request #667 from ngan/fix-ruby-2.7-deprecations
- fix: Merge remote-tracking branch 'origin/master' into fix-ar-internal-metadata-truncation
- fix: Revert "temporarily point at new_adapter_api branch for adapters under test so that travis is green for the PR."
- fix: encountering ssl errors on travis due to AddTrust CA root expiry. upgrade to bionic to fix.
- fix: fix 2017-04-19 to 2018-04-19, close #583
- fix: fix acceptance tests to actually use default strategy, now that :truncation is no longer a safe default for all adapters.
- fix: fix couch potato gem bin/setup.
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
DatabaseCleaner/database_cleaner was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 09b47d03cce420c915b10eb595936ef4397b55ac — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.