[openstreetmap/openstreetmap-website] Use a state machine for user status (PR #3419)
Andy Allan
notifications at github.com
Thu Jan 13 09:57:37 UTC 2022
@gravitystorm commented on this pull request.
> + # Used in test suite, not something that we would normally need to do.
+ event :deactivate do
+ transitions :from => :active, :to => :pending
+ end
It's only used in the factory, not in test cases. In the tests we want to default to having users in the "active" state for the vast, vast majority of test cases, but then there's no way to get a user back into the "pending" state for those tests that need it, because direct attribute assignment is disabled.
I think rather than a guard I might change it to being wrapped in the check, so that if you e.g. make a diagram using aasm-diagram it doesn't show up.
I'm open to better ideas - I thought that there might be a way in FactoryBot to set the attribute without aasm complaining but I couldn't find out how. See also https://github.com/aasm/aasm/issues/523
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3419#discussion_r783801570
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/3419/review/851489185 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220113/1e109f7b/attachment.htm>
More information about the rails-dev
mailing list