Skip to content

Race condition check: index volunteers system spec#6748

Merged
FireLemons merged 1 commit intorubyforgood:mainfrom
hexdevs:sb-volunteers-system-spec-take-2-6698
Mar 7, 2026
Merged

Race condition check: index volunteers system spec#6748
FireLemons merged 1 commit intorubyforgood:mainfrom
hexdevs:sb-volunteers-system-spec-take-2-6698

Conversation

@stefannibrasil
Copy link
Copy Markdown
Contributor

@stefannibrasil stefannibrasil commented Mar 7, 2026

What github issue is this PR for, if any?

Related #6698

What changed, and why?

In terms of hitting the database, this test wasn't that bad. But since I was reviewing it, I found these low hanging fruits to improve:

  • Creates fewer volunteer records, keeping them to a minimum
  • Assigning a volunteer to a supervisor seems to be enough, and doing that avoids creating unnecessary associations when using the with_assigned_supervisor trait. Assigning a supervisor to a volunteer creates fewer associations.
  • Additionally, creating records when building is possible, creating fewer records, and reusing the same supervisor factory keeps the test setup faster.

How is this tested? (please write rspec and jest tests!) 💖💪

Everything is tests ⭐

In terms of hitting the database, this test wasn't that bad.
But since I was reviewing it, I found these low hanging fruits to
improve:

Assigning a volunteer to a supervisor seems to be enough,
and doing that avoids creating unnecessary associations
when using the `with_assigned_supervisor` trait.

Additionally, creating records when building is possible, creating
fewer records, and reusing the same supervisor factory keeps the
test setup faster.
@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 labels Mar 7, 2026
@stefannibrasil stefannibrasil marked this pull request as ready for review March 7, 2026 01:01
@FireLemons FireLemons merged commit a887b59 into rubyforgood:main Mar 7, 2026
11 checks passed
@FireLemons
Copy link
Copy Markdown
Collaborator

🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ruby Pull requests that update Ruby code Tests! 🎉💖👏

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants