# DatabaseCleaner/database_cleaner

Strategies for cleaning databases in Ruby.  Can be used to ensure a clean state for testing.

Repository: https://github.com/DatabaseCleaner/database_cleaner
Canonical: https://ross.abutalabs.com/products/database_cleaner
Homepage: https://www.rubydoc.info/github/DatabaseCleaner/database_cleaner
Language: Ruby
License: MIT
License Family: permissive
Topics: testing, ruby, database-cleaner, testing-tools
Last push: 2026-06-01T18:01:14+00:00

## Health v2 (maintenance only)
Score: 70/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 85, release rhythm 35, longevity 100
- inputs: {"age_days": 6390, "days_push": 93, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2965, forks 485 (observed 2026-08-28T04:07:32.493275+00:00)

## What it is
A set of Ruby gems providing strategies for cleaning databases, primarily to ensure a clean state during tests. It supports multiple ORMs and databases through adapter gems such as database_cleaner-active_record, database_cleaner-mongo, and database_cleaner-redis.

## Use cases
- reset database state between tests in a ruby app
- clean database tables after each rspec example
- truncate tables in a test database
- wipe redis and mongo data between test runs
- ensure a clean database state for integration tests

## When to choose
- you are writing Ruby tests that touch a database and need repeatable clean state
- you use multiple ORMs (ActiveRecord, Mongoid, Redis) and want a unified cleaning API
- you need configurable strategies like truncation or transactions

## When to avoid
- your app is not written in Ruby
- you only need simple transactional test fixtures already provided by your test framework
- you need production data cleanup rather than test-state management

## Facets
- artifact type: library
- maturity: active
- function: testing, database
- domain: testing, databases, developer-tools
- platform: ruby
- tags: database-cleaner, test-fixtures, orm-adapters, truncation, transaction-strategy

## Member repositories
- DatabaseCleaner/database_cleaner (main) score 70

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:32.493275+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:32:02.614590+00:00, confidence not recorded.
  - readme: https://github.com/DatabaseCleaner/database_cleaner (fetched 2026-08-28T04:07:32.493275+00:00, sha 75504311082d)
  - homepage: https://www.rubydoc.info/github/DatabaseCleaner/database_cleaner (fetched 2026-08-29T09:47:11.467457+00:00, sha 37a94e6e6297)
- Data as of 2026-08-30T08:39:29.467469+00:00.
