human-essentials
human-essentials copied to clipboard
Change agency_type to a Rails enum
Summary
There are a number of tests that check PartnerProfile#agency_type
against a string "Other". Some other tests check the value in an array instead:
Partner::AGENCY_TYPES['OTHER']
This seems to be hiding a hidden issue, which is that this field really should be an enum. We don't need to go all the way to defining a Postgres enum; we can just turn the field into a Rails enum as documented here.
Things to consider
A bonus to this would be moving the AGENCY_TYPES
map from the Partner
class to the PartnerProfile
class, as that's where it's actually used.
Criteria for Completion
- [] Agency type is a Rails enum.
- Specs are updated to query e.g.
profile.other?
instead of checking against any specific string value. - All other functionality still works as expected.