Skip to content

fix: Prevent ActiveRecord constant leak in uniqueness matcher#1694

Merged
matsales28 merged 1 commit intomainfrom
matheussales/1663-fix-active-record-constant-leak
Feb 1, 2026
Merged

fix: Prevent ActiveRecord constant leak in uniqueness matcher#1694
matsales28 merged 1 commit intomainfrom
matheussales/1663-fix-active-record-constant-leak

Conversation

@matsales28
Copy link
Member

When using the validate_uniqueness_of matcher, test model classes were being added to ActiveRecord::Base.descendants and not being removed after the matcher ran. This could lead to unexpected behavior in tests that rely on the list of ActiveRecord descendants.

Closes #1663

@matsales28 matsales28 self-assigned this Jan 30, 2026
@matsales28 matsales28 force-pushed the matheussales/1663-fix-active-record-constant-leak branch from 8a46d57 to 26f67cb Compare January 30, 2026 18:13
When using the validate_uniqueness_of matcher, test model classes were
being added to ActiveRecord::Base.descendants and not being removed
after the matcher ran. This could lead to unexpected behavior in tests
that rely on the list of ActiveRecord descendants.

Closes #1663
@matsales28 matsales28 force-pushed the matheussales/1663-fix-active-record-constant-leak branch from 26f67cb to 0c25055 Compare January 30, 2026 18:16
@matsales28 matsales28 merged commit 092747b into main Feb 1, 2026
22 checks passed
@matsales28 matsales28 deleted the matheussales/1663-fix-active-record-constant-leak branch February 1, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

validate_uniqueness_of sometimes leaks test model class into ActiveRecord::Base.descendants

1 participant