thoughtbot/factory_bot
63.9
Adequate · 14 November 2026
2.6k
lines of production code
Ruby
primary language
7
measurements over time
What this system is
Features
Added developer console and setup scripts
New executable scripts have been added to the bin directory to improve local development workflows. The bin/console script provides an interactive Ruby IRB environment pre-loaded with Bundler and FactoryBot, facilitating easier debugging and testing. The bin/setup script automates the initial environment configuration by running bundle install with strict error handling.
bin · high confidence
Added step definitions for FactoryBot and database assertions
New step definitions have been added to support Cucumber integration with FactoryBot and database verification. The \factory\_bot\_steps.rb\ file introduces steps to dynamically add factory definition files to FactoryBot's search path (both relative and absolute), create factory instances, reload factories, and trigger definition loading. The \database\_steps.rb\ file adds a step to verify that the last created Category record matches expected attributes provided in a Cucumber table, along with a hook to clear all Category records before each scenario.
_features/step\definitions · high confidence
Automated changelog generation for releases
A new Rake task \release:update\_changelog\ has been added to automate the creation of release notes. Running this task (e.g., \rake release:update\_changelog\[VERSION\]\) automatically gathers merged pull requests since the last release tag via the GitHub CLI and appends them to \NEWS.md\, replacing the previous 'Unreleased' section with a dated entry for the specified version.
tasks · high confidence
Initialize Cucumber support environment with SQLite and factory definitions
The Cucumber test suite now includes a dedicated support directory containing an environment setup file and factory definitions. The environment file configures the test runtime by requiring ActiveRecord, FactoryBot, and Aruba, while the factory file establishes an in-memory SQLite database and defines a basic Category schema to support feature specifications.
features/support · high confidence
Removals
Removed legacy Factory class definition
The legacy \Factory\ class definition in \lib/factory\_girl/factory.rb\ has been removed. This cleanup eliminates the empty class stub, reflecting the library's evolution where factory definitions are now handled by the \FactoryGirl\ module and its associated classes rather than a standalone \Factory\ class.
_lib/factory\girl · high confidence
Behavioural changes
Add support for Rails 7.0, 7.1, 7.2, 8.0, and main branch
The gemfile matrix has been expanded to include new Appraisal configurations for Rails 7.0, 7.1, 7.2, 8.0, and the Rails main development branch. This allows the library to be tested against these specific versions of ActiveRecord, ensuring compatibility with the latest and upcoming releases of the Rails framework.
gemfiles · high confidence
FactoryBot v6.6.0: Major internal refactoring and new sequence capabilities
This release introduces a significant internal refactoring of the core library, replacing the previous \AttributeHash\ and \DefinitionProxy\ logic with a new, explicit class hierarchy (\Attribute\, \Declaration\, \Evaluator\, \AttributeAssigner\) to improve maintainability and performance. For users, this brings new sequence features, including the ability to rewind sequences and set their initial values lazily. The library also adds \before(:all)\ and \after(:all)\ callback support, introduces \traits\_for\_enum\ for generating traits from enum values, and allows factories to define aliases for easier referencing. Additionally, linting transactions are now isolated from the ActiveRecord lifecycle, and several deprecated internal methods have been removed.
_lib/factory\bot · high confidence
FactoryGirl renamed to FactoryBot with new public API
The library has been renamed from FactoryGirl to FactoryBot. The old \lib/factory\_girl.rb\ entry point is removed, and a new \lib/factory\_bot.rb\ provides the main interface. This entry point exposes new configuration options (\use\_parent\_strategy\, \automatically\_define\_enum\_traits\, \sequence\_setting\_timeout\) and public methods for linting (\FactoryBot.lint\), managing sequences (\rewind\_sequence\, \set\_sequence\), and accessing factories/strategies via the \Internal\ module. The change also introduces a deprecation warning for version 7.0.
lib · high confidence
Improved error messages and self-referencing trait validation
Factory Bot now provides more helpful feedback when configuration errors occur. If an association receives an invalid factory argument or attribute override, it raises an error suggesting the correct syntax (e.g., 'Did you mean? factory: :name'). Additionally, defining a trait that references itself now raises a clear TraitDefinitionError instead of failing silently or with a confusing stack trace.
_lib/factory\bot/declaration · high confidence
New sequence generation methods and internalized syntax registration
FactoryBot now exposes \generate\ and \generate\_list\ methods in the \FactoryBot::Syntax::Methods\ module, allowing users to retrieve the next value or a list of values from a global or factory-scoped sequence by URI. The syntax DSL (\lib/factory\_bot/syntax/default.rb\) has been restructured to delegate factory, sequence, and trait registration to the new \FactoryBot::Internal\ module, centralizing internal state management while maintaining the existing \define\ and \modify\ entry points.
_lib/factory\bot/syntax · high confidence
Refactor decorator internals to support Ruby 2.7+ and improve reliability
The decorator subsystem has been refactored to address Ruby 2.7 keyword argument warnings and prevent recursive calls in attribute handling. New or updated decorator classes now include \AttributeHash\ to safely aggregate attributes without recursion, \DisallowsDuplicatesRegistry\ to explicitly raise errors on duplicate registrations, \InvocationTracker\ to monitor method calls using modern splat syntax, and \NewConstructor\ to delegate instance creation. These changes ensure compatibility with newer Ruby versions and make factory behavior more predictable by preventing silent failures or warnings during object construction.
_lib/factory\bot/decorator · high confidence
Refactored strategy implementations and enhanced build\_stubbed behavior
The strategy classes in lib/factory\_bot/strategy have been restructured into distinct files (AttributesFor, Build, Create, Null, and Stub). For the build\_stubbed strategy, the change ensures that stubbed models now correctly set created\_at and updated\_at timestamps if they are missing, and it adds support for UUID primary keys and models without ID setters. Additionally, the stub strategy now aligns the \#destroyed state with \#new\_record/\#persisted and allows defining a starting ID for stubs.
_lib/factory\bot/strategy · high confidence
Test coverage
Added acceptance tests for factory definitions and behaviors; Added comprehensive test coverage for FactoryBot core components; Added custom RSpec matchers for testing; Added feature tests for factory definition discovery and reloading; Added shared examples for strategy behavior testing; Added test coverage for FactoryBot strategies; Added test support for thread-safe logging; Added test support macros for in-memory database and deprecation handling; Added tests for AttributeHash decorator; Added tests for association, dynamic, and sequence attribute handling; Added tests for declaration equality and attribute resolution; Migrate test suite to RSpec and update spec configuration; Removed legacy Test::Unit test infrastructure.
Dependencies
factory\_bot 6.6.0 release with Ruby 3.0+ and Rails 8 support
The factory\_bot gem has been updated to version 6.6.0, raising the minimum required Ruby version to 3.0.0 and updating the runtime dependency on activesupport to require version 6.1.0 or higher. This aligns the library with modern Ruby and Rails versions, including support for Rails 8 (activesupport 8.0.3), while also updating development dependencies such as RSpec 3.13, Standard 1.51.1, and Cucumber 10.1.1 to their latest stable releases.
(dependencies) · high confidence
Housekeeping
Repository initialization with development tooling and documentation
The repository has been initialized with essential configuration files for development and testing, including \.gitignore\, \.irbrc\ (providing a \reload!\ helper for the IRB console), \.rspec\, \.simplecov\, \.standard.yml\, \.tool-versions\, and \Appraisals\ for testing against multiple Rails versions. It also includes core documentation files such as \README.md\, \CONTRIBUTING.md\, \CODE\_OF\_CONDUCT.md\, \SECURITY.md\, \NAME.md\, and \GETTING\_STARTED.md\, along with a \Rakefile\ for running specs and linting.
(repo-wide) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 65 → 64 (-1.1)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 75 → 73 (-2.0)
- Architecture 99 → 99 (-0.1)
- Maturity 50 → 50 (+0.0)
- Readiness 74 → 74 (-0.1)
- Security 77 → 72 (-5.4)
- Domain Modelling 100 → 100 (+0.0)
Resolved (2)
- Medium CVE: [GHSA redacted] (Gemfile.lock)
- Medium vulnerability: [GHSA redacted] (Gemfile.lock)
New (3)
- High CVE: [GHSA redacted] (Gemfile.lock)
- Medium CVE: [GHSA redacted] (Gemfile.lock)
- Outdated: cucumber
Changes since last survey
- 1 commits — 1 feature/other, 0 fixes
By area
- (root) — 1 commit
Notable commits
- change: Declare cucumber as a development dependency (#1856)
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
thoughtbot/factory_bot 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 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit cf9b56fbdd0d8a54bc5ff54ec701feb9c4559083 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-36d4cd83012f.