brainspec/enumerize
68.3
Adequate · 19 September 2026
1.2k
lines of production code
Ruby
primary language
1
measurement over time
What this system is
This system is the Enumerize gem, a Ruby library that provides enumerized attributes for models across ActiveRecord, ActiveModel, Sequel, and Mongoid. It enables developers to define typed, validated enum fields with support for multiple values, default handling, and query scopes. The library integrates with common form builders like SimpleForm and Formtastic, and includes dedicated RSpec matchers and RailsAdmin support for testing and administration.
How it got here
2012 — Enumerize 3.0.0 major release
7 changes.
This period focused on the major upgrade of the Enumerize gem to version 3.0.0, involving a complete rewrite of the core library to support modern Ruby and Rails versions. The work introduced scope support for ORM integrations, new integration hooks for form builders and validators, and a comprehensive test suite to ensure compatibility and correctness.
2013–2017 — ORM and testing integrations
6 changes.
This period focused on expanding the library's compatibility by adding native support for Sequel and Mongoid adapters, including query scope generation. It also introduced a comprehensive RSpec matcher for testing enumerized attributes and established a robust test configuration to support these new features.
Features
Add enumerize plugin to Sequel
A new enumerize plugin has been added to the Sequel library, located at lib/sequel/plugins/enumerize.rb. This plugin integrates the Enumerize gem with Sequel models by automatically loading the def\_dataset\_method plugin if it is not already present, and extending the model instance with Enumerize functionality.
lib/sequel · high confidence
Add scope generation support for Mongoid and Sequel adapters
Enumerize now supports generating query scopes for Mongoid and Sequel models in addition to the existing ActiveRecord support. Users can define scopes on enumerized attributes using the \:scope\ option, which generates methods like \with\\<attribute\>\ and \without\\<attribute\>\ to filter records by enumerized values. The implementation also supports \:shallow\ scopes, which create individual methods for each enum value (e.g., \status\_active\, \not\_status\_active\). This allows consistent scoping behavior across all three supported ORMs.
lib/enumerize/scope · high confidence
New RSpec matcher and RailsAdmin integration for enumerized attributes
Users can now use a dedicated RSpec matcher to test enumerized attributes, available by requiring 'enumerize/integrations/rspec'. Additionally, the library now includes a RailsAdmin integration that ensures the \_enum method correctly returns the attribute's options, improving compatibility with the RailsAdmin interface.
lib/enumerize/integrations · high confidence
New RSpec matcher for enumerized attributes
A new RSpec matcher is now available for testing enumerized attributes, allowing users to verify attribute definitions, expected values, default values, i18n scopes, predicates, multiple-value support, and scopes. The matcher supports chaining qualifiers like \in\, \with\_default\, \with\_i18n\_scope\, \with\_predicates\, \with\_multiple\, and \with\_scope\ to specify detailed expectations, and provides clear failure messages and descriptions for better debugging.
lib/enumerize/integrations/rspec · high confidence
New integration hooks for Formtastic, SimpleForm, Sequel, and Uniqueness validation
This change introduces four new integration modules in the \lib/enumerize/hooks\ directory. The \Formtastic\ and \SimpleForm\ hooks patch their respective form builders to automatically detect enumerized attributes and configure input options (such as setting collections and enabling multiple selection for multiple-value enums). The \Sequel\ hook ensures that \Enumerize::Value\ objects are correctly converted to their underlying values when appending to SQL literals. Additionally, the \Uniqueness\ validator hook extracts the actual value from enumerized attributes before performing uniqueness checks, ensuring validation works correctly with enumerized fields.
lib/enumerize/hooks · high confidence
Behavioural changes
Enumerize 3.0.0: Rails 8.1 compatibility and ActiveModel fixes
This release updates the gem to support Ruby 3.1+ and Rails 7.0+, with specific fixes for Rails 8.1 compatibility. It ensures that enumerized readers on plain \ActiveModel::Attributes\ objects return an \Enumerize::Value\ by wrapping values in \\#cast\, and fixes \Type\#deserialize\ to properly handle arrays for \multiple: true\ attributes. The release also allows objects to \becomes\ a non-Enumerize model and fixes \Type\#cast\ to support Rails 8.0 bulk operations.
(repo-wide) · high confidence
Enumerize library upgraded to version 3.0.0
The enumerize gem has been updated to version 3.0.0. This release includes a complete rewrite of the core library files (lib/enumerize/\*), introducing new modules for handling ActiveModel and ActiveRecord attributes, Mongoid, and Sequel integrations. Key behavioral changes include improved support for multiple attributes, better handling of default values via callbacks, and enhanced validation logic. The update also adds support for predicate methods and ensures compatibility with modern Rails versions by utilizing ActiveModel::Attributes and ActiveRecord::Type systems.
lib/enumerize · high confidence
Refactored core module structure and added scope support for ORM integrations
The library has been restructured to use \extend\ instead of \include\ for module inclusion, with a deprecation warning issued for the old \include Enumerize\ pattern. This change accompanies the introduction of scope support for ActiveRecord, Sequel, and Mongoid, allowing enumerized attributes to be used in query scopes. The core logic is now split into autoloaded sub-modules (Base, Attribute, Value, etc.), and integrations for SimpleForm, Formtastic, and RSpec are loaded conditionally to avoid hard dependencies.
lib · high confidence
Test coverage
Add RSpec test configuration and helper setup; Added test support infrastructure for view and enum testing; Added tests for the Enumerize RSpec matcher; Comprehensive test suite for enumerized attributes across frameworks.
Dependencies
Initial gem specification and dependency declaration for enumerize
The project now defines its package metadata and runtime requirements through enumerize.gemspec, replacing the previous Gemfile-based setup. This change specifies that the gem requires Ruby 3.2 or higher and declares a runtime dependency on activesupport version 3.2 or later, while also populating essential metadata such as the MIT license, author contact, and repository links.
(dependencies) · 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 68.
Lenses
- Code Health 100
- Architecture 69
- Maturity 59
- Readiness 72
- Security 96
Changes since last survey
- 300 commits — 257 feature/other, 43 fixes
By area
- (root) — 113 commits
- (repo) — 90 commits
- lib/enumerize — 54 commits
- .github/workflows — 16 commits
- test/activerecord_test.rb — 8 commits
- lib/enumerize.rb — 2 commits
- lib/sequel — 2 commits
- test/activemodel_test.rb — 2 commits
- test/base_test.rb — 2 commits
- test/support — 2 commits
- test/test_helper.rb — 2 commits
- test/value_test.rb — 2 commits
- .github/dependabot.yml — 1 commit
- spec/spec_helper.rb — 1 commit
- test/attribute_test.rb — 1 commit
- test/multiple_test.rb — 1 commit
- test/sequel_test.rb — 1 commit
Notable commits
- fix: Define Type#cast instead of deserialize to fix serialization issue.
- fix: Fix ActiveRecord extension when Rails master is used.
- fix: Fix NoMethodError: undefined method `values' for nil:NilClass
- fix: Fix README for User.status.values (#1)
- fix: Fix Type#cast to support Rails 8.0 bulk operations (#469)
- fix: Fix Type#deserialize to handle arrays for multiple: true attributes (#473)
- fix: Fix an example code in readme
- fix: Fix attribute type cast for duplicated record.
- fix: Fix form helpers tests for Rails 5.1
- fix: Fix global use of must_xxx is deprecated.
- fix: Fix issue with ActiveRecord reload
- fix: Fix issue with RSpec#with_predicates matcher when custom values are used as attribute.
- fix: Fix mysql config.
- fix: Fix readme
- fix: Fix sqlite3's version to 1.3.6 series
- fix: Merge branch 'master' into fix-predicate_method-with-invalid-value
- fix: Merge pull request #226 from smoriwaki/fix/fix_bug_about_validation_of_presence_with_multiple_attributes
- fix: Merge pull request #259 from brainspec/fix-257
- fix: Merge pull request #289 from brainspec/fix/issue-286
- fix: Merge pull request #303 from troter/fix-minitest-5-11-x
- …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
brainspec/enumerize 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 8688372f15af9b5c42921f7547eac3533a633499 — 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.