Set up seeds to make it easier to test join codes - #999
Conversation
This makes it harder to test join codes, as we want to have a student that isn't in a class. Only assign students to the teachers class, not the creators class.
This will make it easier to test join codes in the e2e tests
It was hard to see at a glance the data the classes were being set up with. Extract the data to keep it separate from the control flow.
There was a problem hiding this comment.
🟡 Changes recommended
The seeded “John Doe’s Class” owner is currently derived from SEEDING_CREATOR_ID instead of SEEDING_TEACHER_ID, which can seed the teacher class under the wrong user when env overrides are used.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the test_seeds rake task to create deterministic school classes with known join codes and to only assign students to specific classes, making join-code-related integration tests more reliable.
Changes:
- Introduces a small data structure to define seeded classes (including fixed join codes and whether students should be assigned).
- Extends seed helper class creation to optionally set an explicit
join_code. - Updates the
test_seedsspec to locate the specific seeded class via the teacher association.
File summaries
| File | Description |
|---|---|
| spec/lib/test_seeds_spec.rb | Updates the student-assignment spec to look up the teacher’s class via joins(:teachers) to match the new seeding behavior. |
| lib/tasks/test_seeds.rake | Adds deterministic class definitions (including fixed join codes) and seeds only selected classes with students. |
| lib/tasks/seeds_helper.rb | Extends create_school_class to accept an optional join code and persist it when creating the class. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Test coverage93.51% line coverage reported by SimpleCov. |
Status
What's changed?
This will set up data in a way that makes it easier to test join codes