impress/spec/models
Emi Matchu 39bed6b157 Make Item's update_cached_fields callback more reliable
In our tests, I discovered an unexpected behavior where calling
`item.swf_assets << swf_asset` wasn't updating computed fields
correctly.

This isn't something we actually do in-app, I think the modeling system
happened to trigger the callbacks in a way that still worked fine?

But I think this is a good idea for reliability, since caching is such
a notoriously difficult thing to get right anyway! And it makes our
tests simpler and clearer.

Specifically, `compatible_body_ids` references `swf_assets`, which, I'm
kinda surprised, *doesn't* include the newly-added asset yet when the
`ParentSwfAssetRelationship.after_save` hook runs while calling
`item.swf_assets << swf_asset`. Reloading it fixes this!
2024-11-19 14:26:06 -08:00
..
color_spec.rb Improve Solargraph LSP in our spec files 2024-11-19 11:28:36 -08:00
item_spec.rb Make Item's update_cached_fields callback more reliable 2024-11-19 14:26:06 -08:00
pet_spec.rb Improve Solargraph LSP in our spec files 2024-11-19 11:28:36 -08:00
pet_type_spec.rb Improve Solargraph LSP in our spec files 2024-11-19 11:28:36 -08:00
species_spec.rb Improve Solargraph LSP in our spec files 2024-11-19 11:28:36 -08:00