diff --git a/app/controllers/concerns/vet360/writeable.rb b/app/controllers/concerns/vet360/writeable.rb index 3d02d70e80a..b7d3bc8638c 100644 --- a/app/controllers/concerns/vet360/writeable.rb +++ b/app/controllers/concerns/vet360/writeable.rb @@ -39,7 +39,7 @@ def invalidate_cache def build_record(type, params) # This needs to be refactored after V2 upgrade is complete model = if type == 'address' && Flipper.enabled?(:va_v3_contact_information_service, @current_user) - 'VAProfile::Models::V2::Address' + 'VAProfile::Models::V3::Address' else "VAProfile::Models::#{type.capitalize}" end diff --git a/app/models/va_profile_redis/v2/contact_information.rb b/app/models/va_profile_redis/v2/contact_information.rb index a3f78fb72e2..ad56dcfa065 100644 --- a/app/models/va_profile_redis/v2/contact_information.rb +++ b/app/models/va_profile_redis/v2/contact_information.rb @@ -2,7 +2,7 @@ require 'va_profile/v2/contact_information/person_response' require 'va_profile/v2/contact_information/service' -require 'va_profile/models/v2/address' +require 'va_profile/models/v3/address' require 'va_profile/models/telephone' require 'common/models/redis_store' require 'common/models/concerns/cache_aside' @@ -53,7 +53,7 @@ def email def residential_address return unless @user.loa3? - dig_out('addresses', 'address_pou', VAProfile::Models::V2::Address::RESIDENCE) + dig_out('addresses', 'address_pou', VAProfile::Models::V3::Address::RESIDENCE) end # Returns the user's mailing address. In VA Profile, a user can only have one @@ -64,7 +64,7 @@ def residential_address def mailing_address return unless @user.loa3? - dig_out('addresses', 'address_pou', VAProfile::Models::V2::Address::CORRESPONDENCE) + dig_out('addresses', 'address_pou', VAProfile::Models::V3::Address::CORRESPONDENCE) end # Returns the user's home phone. In VA Profile, a user can only have one diff --git a/app/swagger/swagger/schemas/vet360/contact_information.rb b/app/swagger/swagger/schemas/vet360/contact_information.rb index 0086dc28901..3aa378dfe12 100644 --- a/app/swagger/swagger/schemas/vet360/contact_information.rb +++ b/app/swagger/swagger/schemas/vet360/contact_information.rb @@ -5,7 +5,7 @@ require 'va_profile/contact_information/service' require 'va_profile/v2/contact_information/service' require 'va_profile/models/address' -require 'va_profile/models/v2/address' +require 'va_profile/models/v3/address' require 'va_profile/models/telephone' require 'va_profile/models/permission' require 'common/models/redis_store' diff --git a/lib/va_profile/models/v2/address.rb b/lib/va_profile/models/v3/address.rb similarity index 92% rename from lib/va_profile/models/v2/address.rb rename to lib/va_profile/models/v3/address.rb index a806a55e51a..87cbe903575 100644 --- a/lib/va_profile/models/v2/address.rb +++ b/lib/va_profile/models/v3/address.rb @@ -4,15 +4,15 @@ module VAProfile module Models - module V2 - class Address < V2::BaseAddress + module V3 + class Address < V3::BaseAddress attribute :bad_address, Boolean validates(:source_date, presence: true) # Converts a decoded JSON response from VAProfile to an instance of the Address model # @param body [Hash] the decoded response body from VAProfile - # @return [VAProfile::Models::V2::Address] the model built from the response body + # @return [VAProfile::Models::V3::Address] the model built from the response body # rubocop:disable Metrics/MethodLength def in_json address_attributes = { @@ -58,10 +58,10 @@ def in_json # Converts a decoded JSON response from VAProfile to an instance of the Address model # @param body [Hash] the decoded response body from VAProfile - # @return [VAProfile::Models::V2::Address] the model built from the response body + # @return [VAProfile::Models::V3::Address] the model built from the response body # rubocop:disable Metrics/MethodLength def self.build_from(body) - VAProfile::Models::V2::Address.new( + VAProfile::Models::V3::Address.new( address_line1: body['address_line1'], address_line2: body['address_line2'], address_line3: body['address_line3'], @@ -96,7 +96,7 @@ def self.build_from(body) # rubocop:enable Metrics/MethodLength def correspondence? - @address_pou == VAProfile::Models::V2::Address::CORRESPONDENCE + @address_pou == VAProfile::Models::V3::Address::CORRESPONDENCE end end end diff --git a/lib/va_profile/models/v2/base_address.rb b/lib/va_profile/models/v3/base_address.rb similarity index 99% rename from lib/va_profile/models/v2/base_address.rb rename to lib/va_profile/models/v3/base_address.rb index 733f56e3c09..62595ee1bd4 100644 --- a/lib/va_profile/models/v2/base_address.rb +++ b/lib/va_profile/models/v3/base_address.rb @@ -7,7 +7,7 @@ module VAProfile module Models - module V2 + module V3 class BaseAddress < Base include VAProfile::Concerns::Defaultable include VAProfile::Concerns::Expirable diff --git a/lib/va_profile/models/v2/person.rb b/lib/va_profile/models/v3/person.rb similarity index 94% rename from lib/va_profile/models/v2/person.rb rename to lib/va_profile/models/v3/person.rb index e403cadd8eb..86d3d065446 100644 --- a/lib/va_profile/models/v2/person.rb +++ b/lib/va_profile/models/v3/person.rb @@ -8,7 +8,7 @@ module VAProfile module Models - module V2 + module V3 class Person < Base attribute :addresses, Array[Address] attribute :created_at, Common::ISO8601Time @@ -24,12 +24,12 @@ class Person < Base # @return [VAProfile::Models::Person] the model built from the response body def self.build_from(body) body ||= {} - addresses = body['addresses']&.map { |a| VAProfile::Models::V2::Address.build_from(a) } + addresses = body['addresses']&.map { |a| VAProfile::Models::V3::Address.build_from(a) } emails = body['emails']&.map { |e| VAProfile::Models::Email.build_from(e) } telephones = body['telephones']&.map { |t| VAProfile::Models::Telephone.build_from(t) } body['permissions']&.map { |t| VAProfile::Models::Permission.build_from(t) } - VAProfile::Models::V2::Person.new( + VAProfile::Models::V3::Person.new( created_at: body['create_date'], source_date: body['source_date'], updated_at: body['update_date'], diff --git a/lib/va_profile/v2/contact_information/person_response.rb b/lib/va_profile/v2/contact_information/person_response.rb index b580e7a6bc3..ae17642faaa 100644 --- a/lib/va_profile/v2/contact_information/person_response.rb +++ b/lib/va_profile/v2/contact_information/person_response.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true require 'va_profile/response' -require 'va_profile/models/v2/person' +require 'va_profile/models/v3/person' module VAProfile module V2 module ContactInformation class PersonResponse < VAProfile::Response - attribute :person, VAProfile::Models::V2::Person + attribute :person, VAProfile::Models::V3::Person attr_reader :response_body @@ -16,7 +16,7 @@ def self.from(raw_response = nil) new( raw_response&.status, - person: VAProfile::Models::V2::Person.build_from(response_body&.dig('bio')) + person: VAProfile::Models::V3::Person.build_from(response_body&.dig('bio')) ) end diff --git a/lib/va_profile/v2/contact_information/service.rb b/lib/va_profile/v2/contact_information/service.rb index 6a6fad0d18f..3d1a1b76788 100644 --- a/lib/va_profile/v2/contact_information/service.rb +++ b/lib/va_profile/v2/contact_information/service.rb @@ -63,7 +63,7 @@ def self.get_person(vet360_id) def update_address(address) address_type = - if address.address_pou == VAProfile::Models::V2::BaseAddress::RESIDENCE + if address.address_pou == VAProfile::Models::V3::BaseAddress::RESIDENCE 'residential' else 'mailing' diff --git a/lib/va_profile/v2/contact_information/transaction_response.rb b/lib/va_profile/v2/contact_information/transaction_response.rb index 2dc52300849..131b5450c63 100644 --- a/lib/va_profile/v2/contact_information/transaction_response.rb +++ b/lib/va_profile/v2/contact_information/transaction_response.rb @@ -56,9 +56,9 @@ def changed_field address_pou = response_body['tx_output'][0]['address_pou'] case address_pou - when VAProfile::Models::V2::BaseAddress::RESIDENCE + when VAProfile::Models::V3::BaseAddress::RESIDENCE :residence_address - when VAProfile::Models::V2::BaseAddress::CORRESPONDENCE + when VAProfile::Models::V3::BaseAddress::CORRESPONDENCE :correspondence_address else :address diff --git a/modules/mobile/app/services/mobile/v0/profile/sync_update_service.rb b/modules/mobile/app/services/mobile/v0/profile/sync_update_service.rb index d6e70a6f74f..3491ec15528 100644 --- a/modules/mobile/app/services/mobile/v0/profile/sync_update_service.rb +++ b/modules/mobile/app/services/mobile/v0/profile/sync_update_service.rb @@ -59,7 +59,7 @@ def save!(http_method, resource_type, params) def build_record(type, params) if type == :address && Flipper.enabled?(:va_v3_contact_information_service, @user) - 'VAProfile::Models::V2::Address' + 'VAProfile::Models::V3::Address' .constantize .new(params) .set_defaults(@user) diff --git a/modules/mobile/spec/services/sync_update_service_spec.rb b/modules/mobile/spec/services/sync_update_service_spec.rb index 3ea3b19ddea..52f6a449305 100644 --- a/modules/mobile/spec/services/sync_update_service_spec.rb +++ b/modules/mobile/spec/services/sync_update_service_spec.rb @@ -99,7 +99,7 @@ # let(:user) { create(:user, :api_auth_v2) } - # let(:params) { build(:va_profile_address_v2, :override, validation_key: nil) } + # let(:params) { build(:va_profile_v3_address, :override, validation_key: nil) } # context 'when it succeeds' do # let(:transaction) do diff --git a/spec/factories/va_profile/v2/addresses.rb b/spec/factories/va_profile/v3/addresses.rb similarity index 80% rename from spec/factories/va_profile/v2/addresses.rb rename to spec/factories/va_profile/v3/addresses.rb index c0ba9f6bd37..f0b7cabb0d0 100644 --- a/spec/factories/va_profile/v2/addresses.rb +++ b/spec/factories/va_profile/v3/addresses.rb @@ -2,10 +2,10 @@ # This will be removed after ContactInformation has been updated FactoryBot.define do - factory :va_profile_address_v2, class: 'VAProfile::Models::V2::Address' do + factory :va_profile_v3_address, class: 'VAProfile::Models::V3::Address' do address_line1 { '140 Rock Creek Rd' } - address_pou { VAProfile::Models::V2::Address::RESIDENCE } - address_type { VAProfile::Models::V2::Address::DOMESTIC } + address_pou { VAProfile::Models::V3::Address::RESIDENCE } + address_type { VAProfile::Models::V3::Address::DOMESTIC } bad_address { true } city { 'Washington' } country_name { 'USA' } @@ -23,23 +23,23 @@ vet360_id { '1781151' } trait :mailing do - address_pou { VAProfile::Models::V2::Address::CORRESPONDENCE } + address_pou { VAProfile::Models::V3::Address::CORRESPONDENCE } address_line1 { '1515 Broadway' } end trait :domestic do - address_type { VAProfile::Models::V2::Address::DOMESTIC } + address_type { VAProfile::Models::V3::Address::DOMESTIC } end trait :international do - address_type { VAProfile::Models::V2::Address::INTERNATIONAL } + address_type { VAProfile::Models::V3::Address::INTERNATIONAL } international_postal_code { '100-0001' } state_code { nil } zip_code { nil } end trait :military_overseas do - address_type { VAProfile::Models::V2::Address::MILITARY } + address_type { VAProfile::Models::V3::Address::MILITARY } end trait :multiple_matches do @@ -50,7 +50,7 @@ end trait :override do - address_pou { VAProfile::Models::V2::Address::CORRESPONDENCE } + address_pou { VAProfile::Models::V3::Address::CORRESPONDENCE } address_line1 { '1494 Martin Luther King Rd' } address_line2 { 'null' } city { 'Fulton' } diff --git a/spec/factories/va_profile/v2/persons.rb b/spec/factories/va_profile/v3/persons.rb similarity index 67% rename from spec/factories/va_profile/v2/persons.rb rename to spec/factories/va_profile/v3/persons.rb index b9986a44b23..33cb1dc6640 100644 --- a/spec/factories/va_profile/v2/persons.rb +++ b/spec/factories/va_profile/v3/persons.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true FactoryBot.define do - factory :person_v2, class: 'VAProfile::Models::V2::Person' do - addresses { [FactoryBot.build(:va_profile_address_v2), FactoryBot.build(:va_profile_address_v2, :mailing)] } + factory :person_v2, class: 'VAProfile::Models::V3::Person' do + addresses { [FactoryBot.build(:va_profile_v3_address), FactoryBot.build(:va_profile_v3_address, :mailing)] } emails { [FactoryBot.build(:email, :contact_info_v2)] } telephones { [FactoryBot.build(:telephone, :contact_info_v2)] } source_date { '2018-04-09T11:52:03-06:00' } diff --git a/spec/lib/common/models/concerns/cache_aside_spec.rb b/spec/lib/common/models/concerns/cache_aside_spec.rb index 83c09cc2108..74bed3f0819 100644 --- a/spec/lib/common/models/concerns/cache_aside_spec.rb +++ b/spec/lib/common/models/concerns/cache_aside_spec.rb @@ -49,7 +49,7 @@ before do Flipper.enable(:va_v3_contact_information_service) - allow(VAProfile::Models::V2::Person).to receive(:build_from).and_return(person) + allow(VAProfile::Models::V3::Person).to receive(:build_from).and_return(person) end describe '#do_cached_with', :initiate_vaprofile, :skip_vet360 do diff --git a/spec/lib/va_profile/models/v2/address_spec.rb b/spec/lib/va_profile/models/v3/address_spec.rb similarity index 93% rename from spec/lib/va_profile/models/v2/address_spec.rb rename to spec/lib/va_profile/models/v3/address_spec.rb index 197852ab1d2..934fb929c57 100644 --- a/spec/lib/va_profile/models/v2/address_spec.rb +++ b/spec/lib/va_profile/models/v3/address_spec.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true require 'rails_helper' -require 'va_profile/models/v2/address' +require 'va_profile/models/v3/address' -describe VAProfile::Models::V2::Address do - let(:address) { build(:va_profile_address_v2) } +describe VAProfile::Models::V3::Address do + let(:address) { build(:va_profile_v3_address) } describe 'geolocation' do it 'returns gelocation information' do @@ -107,7 +107,7 @@ end context 'when address_type is domestic' do - let(:address) { build(:va_profile_address_v2, :domestic) } + let(:address) { build(:va_profile_v3_address, :domestic) } it 'city must only have US-ASCII characters' do address.city = '12-34 2nd & 31st Street!' @@ -142,7 +142,7 @@ end context 'when address_type is international' do - let(:address) { build(:va_profile_address_v2, :international) } + let(:address) { build(:va_profile_v3_address, :international) } it 'province must only have US-ASCII characters' do address.province = '12-34 2nd & 31st Street!' @@ -204,7 +204,7 @@ end context 'when address_type is military' do - let(:address) { build(:va_profile_address_v2, :military_overseas) } + let(:address) { build(:va_profile_v3_address, :military_overseas) } it 'state_code is required' do expect(address.valid?).to eq(true) @@ -233,12 +233,12 @@ context 'when address pou is correspondence' do it 'correspondence? is true' do - address.address_pou = VAProfile::Models::V2::Address::CORRESPONDENCE + address.address_pou = VAProfile::Models::V3::Address::CORRESPONDENCE expect(address.correspondence?).to eq(true) end it 'bad address is false' do - address.address_pou = VAProfile::Models::V2::Address::CORRESPONDENCE + address.address_pou = VAProfile::Models::V3::Address::CORRESPONDENCE json = JSON.parse(address.in_json) expect(json['bio']['badAddress']).to eq(false) end @@ -246,12 +246,12 @@ context 'when address pou is residence' do it 'correspondence? is false' do - address.address_pou = VAProfile::Models::V2::Address::RESIDENCE + address.address_pou = VAProfile::Models::V3::Address::RESIDENCE expect(address.correspondence?).to eq(false) end it 'bad address is nil' do - address.address_pou = VAProfile::Models::V2::Address::RESIDENCE + address.address_pou = VAProfile::Models::V3::Address::RESIDENCE json = JSON.parse(address.in_json) expect(json['bio']['badAddress']).to eq(nil) end diff --git a/spec/lib/va_profile/v2/contact_information/service_spec.rb b/spec/lib/va_profile/v2/contact_information/service_spec.rb index ffaf5845a96..7d2631332e3 100644 --- a/spec/lib/va_profile/v2/contact_information/service_spec.rb +++ b/spec/lib/va_profile/v2/contact_information/service_spec.rb @@ -24,7 +24,7 @@ VCR.use_cassette('va_profile/v2/contact_information/person', VCR::MATCH_EVERYTHING) do response = subject.get_person expect(response).to be_ok - expect(response.person).to be_a(VAProfile::Models::V2::Person) + expect(response.person).to be_a(VAProfile::Models::V3::Person) end end @@ -50,7 +50,7 @@ VCR.use_cassette('va_profile/v2/contact_information/person_without_data', VCR::MATCH_EVERYTHING) do response = subject.get_person expect(response).to be_ok - expect(response.person).to be_a(VAProfile::Models::V2::Person) + expect(response.person).to be_a(VAProfile::Models::V3::Person) end end end @@ -154,7 +154,7 @@ describe '#post_address' do let(:address) do - build(:va_profile_address_v2, vet360_id: user.vet360_id, source_system_user: user.icn) + build(:va_profile_v3_address, vet360_id: user.vet360_id, source_system_user: user.icn) end context 'when successful' do @@ -191,7 +191,7 @@ describe '#put_address' do let(:address) do - build(:va_profile_address_v2, :override, vet360_id: user.vet360_id, source_system_user: user.icn) + build(:va_profile_v3_address, :override, vet360_id: user.vet360_id, source_system_user: user.icn) end context 'when successful' do @@ -214,7 +214,7 @@ context 'with a validation key' do let(:address) do - build(:va_profile_address_v2, :override, country_name: nil) + build(:va_profile_v3_address, :override, country_name: nil) end it 'overrides the address error', run_at: '2020-02-14T00:19:15.000Z' do @@ -318,7 +318,7 @@ [ { model_name: 'address', - factory: 'va_profile_address_v2', + factory: 'va_profile_v3_address', trait: 'contact_info_v2', attr: 'residential_address', id: 577_127 diff --git a/spec/lib/va_profile/v2/contact_information/transaction_response_spec.rb b/spec/lib/va_profile/v2/contact_information/transaction_response_spec.rb index 9887ed13274..e12e09fbcfc 100644 --- a/spec/lib/va_profile/v2/contact_information/transaction_response_spec.rb +++ b/spec/lib/va_profile/v2/contact_information/transaction_response_spec.rb @@ -33,7 +33,7 @@ context 'with a residence address change' do before do - body['tx_output'][0]['address_pou'] = VAProfile::Models::V2::BaseAddress::RESIDENCE + body['tx_output'][0]['address_pou'] = VAProfile::Models::V3::BaseAddress::RESIDENCE end it 'has the correct changed field' do @@ -43,7 +43,7 @@ context 'with a correspondence address change' do before do - body['tx_output'][0]['address_pou'] = VAProfile::Models::V2::BaseAddress::CORRESPONDENCE + body['tx_output'][0]['address_pou'] = VAProfile::Models::V3::BaseAddress::CORRESPONDENCE end it 'has the correct changed field' do diff --git a/spec/models/async_transaction/va_profile/base_spec.rb b/spec/models/async_transaction/va_profile/base_spec.rb index 8a4b9659417..af37768d53c 100644 --- a/spec/models/async_transaction/va_profile/base_spec.rb +++ b/spec/models/async_transaction/va_profile/base_spec.rb @@ -366,7 +366,7 @@ def last_transactions_by_class let(:user) { build(:user, :loa3) } let!(:user_verification) { create(:user_verification, idme_uuid: user.idme_uuid) } - let(:address) { build(:va_profile_address_v2, vet360_id: user.vet360_id, source_system_user: user.icn) } + let(:address) { build(:va_profile_v3_address, vet360_id: user.vet360_id, source_system_user: user.icn) } it 'returns an instance with the user uuid', :aggregate_failures do VCR.use_cassette('va_profile/v2/contact_information/post_address_success', VCR::MATCH_EVERYTHING) do diff --git a/spec/models/async_transaction/vet360/base_spec.rb b/spec/models/async_transaction/vet360/base_spec.rb index a9cf13e5c16..7c575c7c82a 100644 --- a/spec/models/async_transaction/vet360/base_spec.rb +++ b/spec/models/async_transaction/vet360/base_spec.rb @@ -249,7 +249,7 @@ let(:user) { build(:user, :loa3) } let!(:user_verification) { create(:user_verification, idme_uuid: user.idme_uuid) } - let(:address) { build(:va_profile_address_v2, vet360_id: user.vet360_id, source_system_user: user.icn) } + let(:address) { build(:va_profile_v3_address, vet360_id: user.vet360_id, source_system_user: user.icn) } it 'returns an instance with the user uuid', :aggregate_failures do VCR.use_cassette('va_profile/v2/contact_information/post_address_success', VCR::MATCH_EVERYTHING) do diff --git a/spec/models/va_profile_redis/v2/contact_information_spec.rb b/spec/models/va_profile_redis/v2/contact_information_spec.rb index e3a21c09a1f..29a3960b177 100644 --- a/spec/models/va_profile_redis/v2/contact_information_spec.rb +++ b/spec/models/va_profile_redis/v2/contact_information_spec.rb @@ -23,7 +23,7 @@ before do Flipper.enable(:va_v3_contact_information_service) - allow(VAProfile::Models::V2::Person).to receive(:build_from).and_return(person) + allow(VAProfile::Models::V3::Person).to receive(:build_from).and_return(person) end [404, 400].each do |status| @@ -104,7 +104,7 @@ describe 'contact information attributes' do context 'with a successful response' do before do - allow(VAProfile::Models::V2::Person).to receive(:build_from).and_return(person) + allow(VAProfile::Models::V3::Person).to receive(:build_from).and_return(person) allow_any_instance_of( VAProfile::V2::ContactInformation::Service ).to receive(:get_person).and_return(person_response) @@ -121,20 +121,20 @@ describe '#residential_address' do it 'returns the users residential address object', :aggregate_failures do - residence = address_for VAProfile::Models::V2::Address::RESIDENCE + residence = address_for VAProfile::Models::V3::Address::RESIDENCE VCR.use_cassette('va_profile/v2/contact_information/person', VCR::MATCH_EVERYTHING) do expect(contact_info.residential_address).to eq residence - expect(contact_info.residential_address.class).to eq VAProfile::Models::V2::Address + expect(contact_info.residential_address.class).to eq VAProfile::Models::V3::Address end end end describe '#mailing_address' do it 'returns the users mailing address object', :aggregate_failures do - correspondence = address_for VAProfile::Models::V2::Address::CORRESPONDENCE + correspondence = address_for VAProfile::Models::V3::Address::CORRESPONDENCE VCR.use_cassette('va_profile/v2/contact_information/person', VCR::MATCH_EVERYTHING) do expect(contact_info.mailing_address).to eq correspondence - expect(contact_info.mailing_address.class).to eq VAProfile::Models::V2::Address + expect(contact_info.mailing_address.class).to eq VAProfile::Models::V3::Address end end end @@ -270,7 +270,7 @@ end before do - allow(VAProfile::Models::V2::Person).to receive(:build_from).and_return(nil) + allow(VAProfile::Models::V3::Person).to receive(:build_from).and_return(nil) allow_any_instance_of( VAProfile::V2::ContactInformation::Service ).to receive(:get_person).and_return(empty_response) diff --git a/spec/requests/swagger_spec.rb b/spec/requests/swagger_spec.rb index eb8bbe46e63..18b737a7210 100644 --- a/spec/requests/swagger_spec.rb +++ b/spec/requests/swagger_spec.rb @@ -2944,7 +2944,7 @@ it 'supports va_profile create or update address api' do expect(subject).to validate(:post, '/v0/profile/addresses/create_or_update', 401) VCR.use_cassette('va_profile/v2/contact_information/put_address_success') do - address = build(:va_profile_address_v2, id: 15_035) + address = build(:va_profile_v3_address, id: 15_035) expect(subject).to validate( :post, @@ -2959,7 +2959,7 @@ expect(subject).to validate(:post, '/v0/profile/addresses', 401) VCR.use_cassette('va_profile/v2/contact_information/post_address_success') do - address = build(:va_profile_address_v2) + address = build(:va_profile_v3_address) expect(subject).to validate( :post, @@ -2974,7 +2974,7 @@ expect(subject).to validate(:put, '/v0/profile/addresses', 401) VCR.use_cassette('va_profile/v2/contact_information/put_address_success') do - address = build(:va_profile_address_v2, id: 15_035) + address = build(:va_profile_v3_address, id: 15_035) expect(subject).to validate( :put, @@ -2989,7 +2989,7 @@ expect(subject).to validate(:delete, '/v0/profile/addresses', 401) VCR.use_cassette('va_profile/v2/contact_information/delete_address_success') do - address = build(:va_profile_address_v2, id: 15_035) + address = build(:va_profile_v3_address, id: 15_035) expect(subject).to validate( :delete, diff --git a/spec/requests/v0/profile/addresses_spec.rb b/spec/requests/v0/profile/addresses_spec.rb index fdec12216da..9cbfb6bb676 100644 --- a/spec/requests/v0/profile/addresses_spec.rb +++ b/spec/requests/v0/profile/addresses_spec.rb @@ -336,7 +336,7 @@ # after do # Flipper.disable(:va_v3_contact_information_service) # end - # let(:address) { build(:va_profile_address_v2, vet360_id: user.vet360_id) } + # let(:address) { build(:va_profile_v3_address, vet360_id: user.vet360_id) } # it 'calls update_address' do # expect_any_instance_of(VAProfile::V2::ContactInformation::Service).to receive(:update_address).and_call_original @@ -357,7 +357,7 @@ Flipper.disable(:va_v3_contact_information_service) end - let(:address) { build(:va_profile_address_v2, vet360_id: user.vet360_id) } + let(:address) { build(:va_profile_v3_address, vet360_id: user.vet360_id) } context 'with a 200 response' do it 'matches the address schema', :aggregate_failures do @@ -474,7 +474,7 @@ log_data = log.data expect(log_data['address_line1']).to eq(address.address_line1) expect(log_data['address_pou']).to eq(address.address_pou) - expect(log.error_class).to eq('VAProfile::Models::V2::Address ValidationError') + expect(log.error_class).to eq('VAProfile::Models::V3::Address ValidationError') end it 'matches the errors schema', :aggregate_failures do @@ -504,7 +504,7 @@ Flipper.disable(:va_v3_contact_information_service) end - let(:address) { build(:va_profile_address_v2, vet360_id: user.vet360_id) } + let(:address) { build(:va_profile_v3_address, vet360_id: user.vet360_id) } context 'with a 200 response' do it 'matches the email address schema', :aggregate_failures do @@ -534,7 +534,7 @@ end context 'with a validation key' do - let(:address) { build(:va_profile_address_v2, :override) } + let(:address) { build(:va_profile_v3_address, :override) } let(:frozen_time) { Time.zone.parse('2024-09-16T16:09:37.000Z') } before do @@ -579,7 +579,7 @@ context 'when effective_end_date is included' do let(:address) do - build(:va_profile_address_v2, effective_end_date: Time.now.utc.iso8601) + build(:va_profile_v3_address, effective_end_date: Time.now.utc.iso8601) end it 'effective_end_date is NOT included in the request body', :aggregate_failures do diff --git a/spec/support/va_profile/stub_vaprofile_user.rb b/spec/support/va_profile/stub_vaprofile_user.rb index 0083a45af5f..b088d88d3d4 100644 --- a/spec/support/va_profile/stub_vaprofile_user.rb +++ b/spec/support/va_profile/stub_vaprofile_user.rb @@ -2,7 +2,7 @@ require 'va_profile/v2/contact_information/service' require 'va_profile/v2/contact_information/person_response' -require 'va_profile/models/v2/address' +require 'va_profile/models/v3/address' require 'va_profile/models/telephone' # rubocop:disable Metrics/MethodLength @@ -13,8 +13,8 @@ def stub_vaprofile_user(person = nil) person ||= build( :person_v2, addresses: [ - build(:va_profile_address_v2, id: 577_127), - build(:va_profile_address_v2, address_pou: VAProfile::Models::V2::Address::CORRESPONDENCE, id: 124) + build(:va_profile_v3_address, id: 577_127), + build(:va_profile_v3_address, address_pou: VAProfile::Models::V3::Address::CORRESPONDENCE, id: 124) ], emails: [ build(:email, :contact_info_v2, id: 318_927)