don't clean the rna champ value

Cleaning the value is useless, when fetching the association,
as the value will be re-written by the dossier update, when the user
fills in the dossier.

Furthermore we need the value to persist when prefilling the champ.
This commit is contained in:
sebastiencarceles 2023-01-13 14:52:16 +01:00
parent 7e55aca107
commit 33fa40eda2
3 changed files with 13 additions and 17 deletions

View file

@ -10,10 +10,10 @@ RSpec.describe RNAChampAssociationFetchableConcern do
subject(:fetch_association!) { champ.fetch_association!(rna) }
shared_examples "an association fetcher" do |expected_result, expected_value, expected_data|
shared_examples "an association fetcher" do |expected_result, _expected_value, expected_data|
it { expect(fetch_association!).to eq(expected_result) }
it { expect { fetch_association! }.to change { champ.reload.value }.to(expected_value) }
it { expect { fetch_association! }.to change { champ.reload.value }.to(rna) }
it { expect { fetch_association! }.to change { champ.reload.data }.to(expected_data) }
end
@ -31,7 +31,7 @@ RSpec.describe RNAChampAssociationFetchableConcern do
let(:status) { 422 }
let(:body) { '' }
it_behaves_like "an association fetcher", nil, nil, nil
it_behaves_like "an association fetcher", nil, '1234', nil
end
context 'when the RNA is unknow' do
@ -49,7 +49,7 @@ RSpec.describe RNAChampAssociationFetchableConcern do
before { expect(APIEntrepriseService).to receive(:api_up?).and_return(false) }
it_behaves_like "an association fetcher", :network_error, nil, nil
it_behaves_like "an association fetcher", :network_error, 'W595001988', nil
end
context 'when the RNA informations are retrieved successfully' do