Skip to content
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

Make UserSchoolInfo tests slightly more resilient #36927

Merged
merged 1 commit into from Sep 28, 2020

Conversation

Hamms
Copy link
Contributor

@Hamms Hamms commented Sep 25, 2020

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:

  • Tests provide adequate coverage
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

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](#36860), 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.
@Hamms Hamms added the Rails Upgrade All work related to upgrading the version of Ruby on Rails we use. label Sep 25, 2020
@Hamms Hamms merged commit 704b82c into staging Sep 28, 2020
@Hamms Hamms deleted the make-userschoolinfos-test-more-resilient branch September 28, 2020 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rails Upgrade All work related to upgrading the version of Ruby on Rails we use.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants