Skip to content

Set up seeds to make it easier to test join codes - #999

Merged
zetter-rpf merged 3 commits into
mainfrom
more-seeds-for-join-codes
Sep 4, 2026
Merged

Set up seeds to make it easier to test join codes#999
zetter-rpf merged 3 commits into
mainfrom
more-seeds-for-join-codes

Conversation

@zetter-rpf

@zetter-rpf zetter-rpf commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Status

What's changed?

  • Set up known join codes for classes
  • Only assign students to specific classes

This will set up data in a way that makes it easier to test join codes

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.
@cla-bot cla-bot Bot added the cla-signed label Sep 4, 2026
@zetter-rpf
zetter-rpf marked this pull request as ready for review September 4, 2026 10:26
Copilot AI lite review requested due to automatic review settings September 4, 2026 10:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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_seeds spec 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.

Comment thread lib/tasks/test_seeds.rake
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Test coverage

93.51% line coverage reported by SimpleCov.
Run: https://github.com/RaspberryPiFoundation/editor-api/actions/runs/33863266871

@raspberrypiherokubot
raspberrypiherokubot temporarily deployed to editor-api-p-more-seeds-q6f3gw September 4, 2026 10:31 Inactive
@zetter-rpf zetter-rpf changed the title More seeds for join codes Set up seeds to make it easier to test join codes Sep 4, 2026
@zetter-rpf
zetter-rpf merged commit 6216cc2 into main Sep 4, 2026
9 checks passed
@zetter-rpf
zetter-rpf deleted the more-seeds-for-join-codes branch September 4, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants