impress/spec
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
..
fixtures Add tests for Maraquan item modeling predictions 2024-11-19 13:31:34 -08:00
models Make Item's update_cached_fields callback more reliable 2024-11-19 14:26:06 -08:00
services Improve Solargraph LSP in our spec files 2024-11-19 11:28:36 -08:00
support Add failing test for modeling bug where we break existing connections 2024-11-06 14:08:32 -08:00
rails_helper.rb Move modeling tests to RSpec 2024-10-21 16:03:58 -07:00
spec_helper.rb Use alias they in specs instead of it, when it reads better 2024-10-25 13:38:02 -07:00