Skip to content

Commit

Permalink
Adds flipper test.
Browse files Browse the repository at this point in the history
  • Loading branch information
stiehlrod committed Nov 22, 2024
1 parent 384dfa7 commit 8736614
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion modules/claims_api/spec/sidekiq/poa_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
require 'bgs_service/person_web_service'
require 'bgs_service/vet_record_web_service'

RSpec.describe ClaimsApi::PoaUpdater, type: :job, vcr: 'bgs/person_web_service/find_by_ssn' do
RSpec.describe ClaimsApi::PoaUpdater, type: :job, vcr: ['bgs/person_web_service/find_by_ssn',
'bgs/vet_record_service/update_birls_record'] do
subject { described_class }

before do
Expand Down Expand Up @@ -199,6 +200,32 @@
end
end

describe 'when the claims_api_use_person_web_service flipper is on' do
let(:person_web_service) { instance_double(ClaimsApi::PersonWebService) }
let(:vet_record_web_service) { instance_double(ClaimsApi::VetRecordWebService) }

before do
allow(Flipper).to receive(:enabled?).with(:claims_api_use_person_web_service).and_return true
allow(Flipper).to receive(:enabled?).with(:claims_api_use_vet_record_web_service).and_return true
allow(ClaimsApi::PersonWebService).to receive(:new).with(external_uid: anything,
external_key: anything)
.and_return(person_web_service)
allow(ClaimsApi::VetRecordWebService).to receive(:new).with(external_uid: anything,
external_key: anything)
.and_return(person_web_service)
allow(person_web_service).to receive(:find_by_ssn).and_return({ file_nbr: '796111863' })
allow(vet_record_web_service).to receive(:update_birls_record).and_return({ return_code: 'BMOD0001' })
end

it 'calls local bgs services instead of bgs-ext' do
poa = create_poa
subject.new.perform(poa.id)

expect(person_web_service).to have_received(:find_by_ssn)
expect(vet_record_web_service).to have_received(:update_birls_record)
end
end

private

def create_poa
Expand Down

0 comments on commit 8736614

Please sign in to comment.