Testing a controller that makes outside api calls

Yep. I’ve had 20MB JSON fixtures and just made utility functions to get pieces of them for smaller unit-testing purposes.

I went even further in one project: I made a special tag for certain tests (called it :exhaustive) and excluded it by default so we don’t overload our CI – but made it a policy to run the tests tagged with it once a week. They used the complete cached payloads from the live API, no matter how big they were (one was 215MB even; long live Zstandard level 19 compression and git lfs!).

A lot of teams grumble about this practice, for reasons they were never able to explain in a satisfactory manner to me, but I’ve uncovered a frightening amount of bugs in code just by using cached real data.