Make UserSchoolInfo tests slightly more resilient #36927
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are two changes in this PR:
First, we explicitly reload the teacher objects being considered here after "time traveling" and before saving. The loose goal here is to more accurately represent the "real-world" user activity we're trying to emulate, in which we expect the user objects to be renewed from the database when the user starts a new session. The more-specific goal is to enable the upgrade to Devise 4.7, which introduced a change to the way the sign-in process persists changes on the user object; that change causes these tests to fail.
Second, we add some assertions around the
update
calls used in these tests. These are just to add clarity to the test; when I first approached these tests to fix the issue above it wasn't clear to me whether the devise change was introducing an actual bug or if the tests themselves were expecting this data to not be persisted. Hopefully these new assertions should make things clearer for the next dev to come poking around.Reviewer Checklist: