shoulda-matchers
shoulda-matchers copied to clipboard
Enum string with_values broken
In my WebinarsIdentity model
enum kind_register: {
live: 'live',
on_demand: 'on_demand'
}, _prefix: true # `prefix` does not affect the crash (apparently)
Failure/Error:
is_expected.to define_enum_for(:kind_register).
with_values(['live', 'on_demand']).
backed_by_column_of_type(:string)
Expected WebinarsIdentity to define :kind_register as an enum, backed by
a string, with possible values ‹["live", "on_demand"]›. However, the
actual enum values for :kind_register are ‹["live", "on_demand"]›.
Well, I don't really know what to do with such output, everything seems correct.
Hmm... that does seem fishy. I'll look into this when I have a chance.
@Loschcode I think this might be a matter of updating the error message here to be more helpful. However, in the meantime, to fix this on your end, you might want to try something like:
is_expected.to define_enum_for(:kind_register).
with_values(live: "live", on_demand: "on_demand").
backed_by_column_of_type(:string).
with_prefix(true)