diff --git a/spec/controllers/account_reset/delete_account_controller_spec.rb b/spec/controllers/account_reset/delete_account_controller_spec.rb index 2d5702daf03..66fbb96a24f 100644 --- a/spec/controllers/account_reset/delete_account_controller_spec.rb +++ b/spec/controllers/account_reset/delete_account_controller_spec.rb @@ -167,7 +167,7 @@ success: true, errors: {}, mfa_method_counts: { phone: 1 }, - profile_idv_level: 'legacy_in_person', + profile_idv_level: 'in_person', identity_verified: true, account_age_in_days: 0, account_confirmed_at: user.confirmed_at, diff --git a/spec/controllers/idv/in_person/ready_to_verify_controller_spec.rb b/spec/controllers/idv/in_person/ready_to_verify_controller_spec.rb index 88f77fd2e31..f475e135858 100644 --- a/spec/controllers/idv/in_person/ready_to_verify_controller_spec.rb +++ b/spec/controllers/idv/in_person/ready_to_verify_controller_spec.rb @@ -44,7 +44,6 @@ context 'with enrollment' do let(:user) { create(:user, :with_pending_in_person_enrollment) } - let(:profile) { create(:profile, :with_pii, user: user) } it 'renders show template' do expect(response).to render_template :show diff --git a/spec/controllers/idv/personal_key_controller_spec.rb b/spec/controllers/idv/personal_key_controller_spec.rb index 6f37ec787c1..5128d3cdd01 100644 --- a/spec/controllers/idv/personal_key_controller_spec.rb +++ b/spec/controllers/idv/personal_key_controller_spec.rb @@ -46,8 +46,6 @@ def assert_personal_key_generated_for_profiles(*profile_pii_pairs) let(:address_verification_mechanism) { 'phone' } - let(:in_person_enrollment) { nil } - let(:idv_session) { subject.idv_session } let(:threatmetrix_review_status) { nil } @@ -524,13 +522,10 @@ def assert_personal_key_generated_for_profiles(*profile_pii_pairs) end context 'with in person profile' do - let!(:in_person_enrollment) do - create(:in_person_enrollment, :pending, user: user).tap do - user.reload_pending_in_person_enrollment - end - end + let!(:profile) { create(:profile, :in_person_verification_pending, user: user) } before do + user.reload_pending_in_person_enrollment allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true) end diff --git a/spec/factories/in_person_enrollments.rb b/spec/factories/in_person_enrollments.rb index 268164e51b2..3678ec43901 100644 --- a/spec/factories/in_person_enrollments.rb +++ b/spec/factories/in_person_enrollments.rb @@ -17,7 +17,12 @@ status { :pending } status_updated_at { Time.zone.now } profile do - association(:profile, :in_person_verification_pending, user: user) + association( + :profile, + :in_person_verification_pending, + user: user, + in_person_enrollment: instance, + ) end end diff --git a/spec/factories/profiles.rb b/spec/factories/profiles.rb index c1483a146d4..c20c42667d2 100644 --- a/spec/factories/profiles.rb +++ b/spec/factories/profiles.rb @@ -37,7 +37,20 @@ trait :in_person_verification_pending do in_person_verification_pending_at { 15.days.ago } - idv_level { :legacy_in_person } + idv_level { :in_person } + in_person_enrollment do + association(:in_person_enrollment, :pending, profile: instance, user:) + end + end + + trait :in_person_verified do + verified_at { Time.zone.now } + activated_at { Time.zone.now } + idv_level { :in_person } + in_person_verification_pending_at { nil } + in_person_enrollment do + association(:in_person_enrollment, :passed, profile: instance, user:) + end end trait :fraud_pending_reason do diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 15ed22e6303..893adf1921d 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -221,9 +221,8 @@ end trait :with_pending_in_person_enrollment do - after :build do |user| - profile = create(:profile, :with_pii, :in_person_verification_pending, user: user) - create(:in_person_enrollment, :pending, user: user, profile: profile) + profiles do + [association(:profile, :with_pii, :in_person_verification_pending, user: instance)] end end @@ -270,16 +269,14 @@ confirmed_at { Time.zone.now.round } after :build do |user| - profile = create( + create( :profile, :with_pii, :active, :verified, - :in_person_verification_pending, + :in_person_verified, user: user, ) - create(:in_person_enrollment, :passed, user: user, profile: profile) - profile.in_person_verification_pending_at = nil end end diff --git a/spec/models/profile_spec.rb b/spec/models/profile_spec.rb index 336c6eee4d4..10a5cc1aa64 100644 --- a/spec/models/profile_spec.rb +++ b/spec/models/profile_spec.rb @@ -612,9 +612,6 @@ describe '#deactivate_due_to_encryption_error' do context 'when the profile has a "pending" in_person_enrollment' do subject { create(:profile, :in_person_verification_pending, user: user) } - let!(:enrollment) do - create(:in_person_enrollment, user: user, profile: subject, status: :pending) - end before do subject.deactivate_due_to_encryption_error diff --git a/spec/views/accounts/show.html.erb_spec.rb b/spec/views/accounts/show.html.erb_spec.rb index 92aacb09d24..443ba48fa41 100644 --- a/spec/views/accounts/show.html.erb_spec.rb +++ b/spec/views/accounts/show.html.erb_spec.rb @@ -95,7 +95,7 @@ end context 'when current user has ipp pending profile' do - let(:user) { build(:user, :with_pending_in_person_enrollment) } + let(:user) { create(:user, :with_pending_in_person_enrollment) } it 'renders idv partial' do expect(render).to render_template(partial: 'accounts/_identity_verification') @@ -114,7 +114,7 @@ context 'when current user has an in_person_enrollment that was failed' do let(:vtr) { ['Pe'] } let(:sp_name) { 'sinatra-test-app' } - let(:user) { build(:user, :with_pending_in_person_enrollment) } + let(:user) { create(:user, :with_pending_in_person_enrollment) } before do # Make the in_person_enrollment and associated profile failed @@ -132,7 +132,7 @@ context 'when current user has an in_person_enrollment that was cancelled' do let(:vtr) { ['Pe'] } let(:sp_name) { 'sinatra-test-app' } - let(:user) { build(:user, :with_pending_in_person_enrollment) } + let(:user) { create(:user, :with_pending_in_person_enrollment) } before do # Make the in_person_enrollment and associated profile cancelled @@ -150,7 +150,7 @@ context 'when current user has an in_person_enrollment that expired' do let(:vtr) { ['Pe'] } let(:sp_name) { 'sinatra-test-app' } - let(:user) { build(:user, :with_pending_in_person_enrollment) } + let(:user) { create(:user, :with_pending_in_person_enrollment) } before do # Expire the in_person_enrollment and associated profile