mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 10:54:22 +08:00
5bd55acf83
Ensures that `UserStat#post_count` and `UserStat#topic_count` does not go below 0. When it does like it did now, we tend to have bugs in our code since we're usually coding with the assumption that the count isn't negative. In order to support the constraints, our post and topic fabricators in tests will now automatically increment the count for the respective user's `UserStat` as well. We have to do this because our fabricators bypasss `PostCreator` which holds the responsibility of updating `UserStat#post_count` and `UserStat#topic_count`. |
||
---|---|---|
.. | ||
topic_guardian_spec.rb | ||
user_guardian_spec.rb |