Revamp specs to stop relying on seeded data
Summary
Currently, our specs create the following data before every single test:
- Create 45 base items.
- Create an organization with 45 items.
- Create 4 org users.
- Create a partner, a partner profile and a partner user.
These are set to instance variables.
This causes all of our specs to be significantly slower since a huge number of specs do not need all this data. It also makes them confusing since it relies on data that was factory-created rather than specifying the data it knows and cares about.
We should do the following:
- Add a metadata tag which, when set, does not create any seeded information.
- Go through each spec (starting with non-system specs), set the metadata tag to true, create any necessary data, and ensure that any organizations created are given the
skip_itemstrait. We may want to add some additional traits (e.g.with_itemsfor organizations) for the rare cases where we actually do need those 45 items. - PRs can be created with groups of specs so we don't have to wait for a big bang release.
- Once every single spec is using this pattern, we can remove the metadata tag from all specs, the
skip_itemstrait, and theseed_itemscall.
Things to consider
No response
Criteria for Completion
No response
I'll take this. I've been wanting to look over the specs and evaluate which specs can be changed system => request, request => model/service, etc.
You got it! Note that this issue doesn't really touch the system -> request movement - although I'm happy to take any PRs on that account as well. You're free to pick whichever one strikes your fancy. IMO this one is more generally useful though, since it affects literally every single test.
This issue is marked as stale due to no activity within 30 days. If no further activity is detected within 7 days, it will be unassigned.
Automatically unassigned after 7 days of inactivity.