thoughtbot / shoulda-matchers

Simple one-liner tests for common Rails functionality
https://matchers.shoulda.io
MIT License
3.5k stars 911 forks source link

Ensure uniqueness validation matcher works with STI #1610

Closed matsales28 closed 7 months ago

matsales28 commented 7 months ago

Quotin @StefSchenkelaars on #1450:

The uniqueness validation matcher generates a fake class when the scope name ends on _type. This fake class is a duplicate of the original class. In most cases this is not a problem, however when using single table inheritance (STI), this new fake class is not a subclass of the original class and therefore ActiveRecord will throw an error. See #1245

These problems are fixed by making the fake class inherrit from the original class. Therefore it closes #1245 and closes #854

matsales28 commented 7 months ago

LGTM! Just one thing: any idea why the CI skipped the test/build process for version 3.3.0, using Rails 7.1 with SQLite3?

Interesting, I didn't notice that. I'm re-running this test process. Not sure why it was skipped