human-essentials icon indicating copy to clipboard operation
human-essentials copied to clipboard

Revamp specs to stop relying on seeded data

Open dorner opened this issue 1 year ago • 4 comments

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_items trait. We may want to add some additional traits (e.g. with_items for 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_items trait, and the seed_items call.

Things to consider

No response

Criteria for Completion

No response

dorner avatar Mar 17 '24 14:03 dorner

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.

elasticspoon avatar Mar 17 '24 21:03 elasticspoon

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.

dorner avatar Mar 18 '24 00:03 dorner

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.

github-actions[bot] avatar Apr 18 '24 00:04 github-actions[bot]

Automatically unassigned after 7 days of inactivity.

github-actions[bot] avatar Apr 26 '24 00:04 github-actions[bot]