-
Couldn't load subscription status.
- Fork 5
Fix to hopefully resolve the flakey seed test by ensuring different ids are used #600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1548609
6780ff2
721f5b5
6322321
6619284
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,13 +2,20 @@ | |||||||||
|
|
||||||||||
| require 'rails_helper' | ||||||||||
| require 'rake' | ||||||||||
| require 'climate_control' | ||||||||||
| require 'securerandom' | ||||||||||
|
|
||||||||||
| RSpec.describe 'for_education', type: :task do | ||||||||||
| let(:creator_id) { '583ba872-b16e-46e1-9f7d-df89d267550d' } # [email protected] | ||||||||||
| let(:teacher_id) { 'bbb9b8fd-f357-4238-983d-6f87b99bdbb2' } # [email protected] | ||||||||||
| let(:student_1) { 'e52de409-9210-4e94-b08c-dd11439e07d9' } # student | ||||||||||
| let(:student_2) { '0d488bec-b10d-46d3-b6f3-4cddf5d90c71' } # student | ||||||||||
| let(:school_id) { 'e52de409-9210-4e94-b08c-dd11439e07d9' } | ||||||||||
| before do | ||||||||||
| # Ensure the school id is unique, to avoid conflicts | ||||||||||
| stub_const('SeedsHelper::TEST_SCHOOL', school_id) | ||||||||||
| end | ||||||||||
|
|
||||||||||
| let(:creator_id) { 'f83ba872-b16e-46e1-9f7d-df89d267550d' } | ||||||||||
| let(:teacher_id) { 'ccc9b8fd-f357-4238-983d-6f87b99bdbb2' } | ||||||||||
|
Comment on lines
+14
to
+15
|
||||||||||
| let(:creator_id) { 'f83ba872-b16e-46e1-9f7d-df89d267550d' } | |
| let(:teacher_id) { 'ccc9b8fd-f357-4238-983d-6f87b99bdbb2' } | |
| let(:creator_id) { '583ba872-b16e-46e1-9f7d-df89d267550d' } # jane_doe from SeedsHelper | |
| let(:teacher_id) { 'bbb9b8fd-f357-4238-983d-6f87b99bdbb2' } # john_doe from SeedsHelper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean these values weren't getting picked up before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they were getting picked up, but state was bleeding between tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I understand how this fixes the bleed in that case 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this no longer needed? Or was it never needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it shouldn't have been needed, given DatabaseCleaner cleans the db between runs...but I think the concurrency was the prob...using unique ids fixes that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
beforehook at the top level will execute for all test contexts, butschool_idis defined usingletwhich is lazily evaluated. This can cause issues with RSpec's evaluation order. Consider usinglet!forschool_idto ensure it's evaluated before thebeforehook, or move thestub_constinto individual test contexts whereschool_idis actually used.