Open lake-effect opened 2 months ago
Hi, thanks for the report! Unfortunately, we can't do much in that case, as the defined values are only stored in the database. I searched for an interface to access those values in the Rails adapters, but it does not exist (so it could work for any database adapter); it might be something nice to add on Rails itself.
If I have some free time, I can try to move that forward in Rails, but I can't promise as I don't have much time now.
Would it work to add a manual override in the matcher API? Something like validate_uniqueness_of(attr, valid_names_to_try)
? Then we could tell the matcher the other names it should try instead of going to the succ
call.
Would it work to add a manual override in the matcher API? Something like
validate_uniqueness_of(attr, valid_names_to_try)
? Then we could tell the matcher the other names it should try instead of going to thesucc
call.
Yes, that's an excellent idea. I'll put that on my backlog of features!
Thanks so much!
Description
The
succ
call described in https://github.com/thoughtbot/shoulda-matchers/issues/854 fails to match when thetype
column being used in STI is an enumerable, because that column's values are restricted.Reproduction Steps
Modify the below reproduction script to match a locally running Postgres install, and then run it.
Expected behavior
Validation passes.
Actual behavior
System configuration
shoulda_matchers version: 6.2.0 rails version: 7.1.3.2 ruby version: 3.2.1