LG-14273: Ensure the in-person verification profile has an enrollment record#11315
Conversation
9b8cd7e to
570b052
Compare
|
Hi there, looks like this PR hasn't seen any updates in a few months. Is it still needed? Or if not, can we close it out? |
|
Hi @zachmargolis, thanks for following up. I was working on this today. I had planned on working on it more during RSpec League meetings, but the group hasn't met as much since we started this PR. My goal is to have a PR in the review process by the end of the week. If I don't make that goal, I am fine with closing this PR. |
570b052 to
90586f9
Compare
In theory, it should never happen that the profile is pending verification and the enrollment record does not exist. changelog: Internal, Automated Testing, Improve test setup for enrolling profiles
…user with_pending_in_person_enrollment trait
fe4a472 to
ea1c154
Compare
|
Hi @zachmargolis, thanks again for following up. This PR is now ready for review. |
| profile = create( | ||
| create( |
There was a problem hiding this comment.
it would be nice if we could do this as a build() instead of a create() but I'm guessing we rely on DB associations and scopes for these, so easier to just always create
There was a problem hiding this comment.
Could you say more about the reason for preferring build() here? Is it because you’d expect build() to be faster than create()? Or is it about wanting to avoid calling create() inside of an after build hook?
There was a problem hiding this comment.
- yes,
build()should be faster thancreate()becausebuildis in-memory only - the other reason is that
after_buildmeans that if an upstream caller of this constructor only builds, intending to be in-memory only, now by callingcreatethis will hit the DB, which may be unexpected and unintended
There was a problem hiding this comment.
I tried making the suggested change, but it broke a spec in the delete account controller spec. I am going to merge the PR as is.
n1zyy
left a comment
There was a problem hiding this comment.
I agree with Zach on a formatting nit, but this is a nice cleanup.
| end | ||
| end | ||
|
|
||
| trait :in_person_verified do |
There was a problem hiding this comment.
Did this just not exist previously? 😮
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
🎫 Ticket
LG-14273: Profile factory in_person_verification_pending does not create InPersonEnrollment
🛠 Summary of changes
In theory, it should never happen that the profile is pending verification and the enrollment record does not exist. A previous discussion in a meeting that I missed brought up the point that the factory does not address this properly.
This is essentially pulling @aduth's work out of #11129 , one of the smallest pieces of that PR that is still useful to the development team on its own. In fact, in pairing with @eileen-nava on this, I basically retraced much of what @aduth had done before @eileen-nava pointed out the repetition.
We looked at pulling in more from #11129 , and doing so looked like it might double the level of effort
List of changes by factory:
pendingtrait in thein_person_enrollmentfactory.in_person_verifiedtrait to theprofilefactory.in_person_verification_pendingtrait in theprofilefactory to use theidv_levelin_person.with_pending_in_person_enrollmenttrait in theuserfactory.proofed_in_person_enrollmenttrait in the user factory to use the new profile trait,in_person_verified.📜 Testing Plan
At @eileen-nava's suggestion when we were working together, we walked through inserting a
binding.pryin a test that uses this factory and made sure that we got appropriate results back. I'm grateful to Eileen for walking me through a complicated process that I didn't understand and pointing out which details should be checked. For example:as well as checking other relational data.
In addition, our test suite is thorough enough that I have high confidence if the full test suite passes with this change. While making only some of these changes, many tests failed loudly.