review: validate prefilled champs only

This commit is contained in:
sebastiencarceles 2022-12-01 12:00:21 +01:00
parent 1e21a3d3e1
commit 373e8aeadb
41 changed files with 54 additions and 3 deletions

View file

@ -28,10 +28,13 @@ RSpec.describe DossierPrefillableConcern do
let(:values) { [{ id: champ_id_1, value: value_1 }, { id: champ_id_2, value: value_2 }] }
it "updates the champs with the new values" do
it "updates the champs with the new values and mark them as prefilled" do
fill
expect(dossier.champs_public.first.value).to eq(value_1)
expect(dossier.champs_public.first.prefilled).to eq(true)
expect(dossier.champs_public.last.value).to eq(value_2)
expect(dossier.champs_public.last.prefilled).to eq(true)
end
end
@ -45,6 +48,10 @@ RSpec.describe DossierPrefillableConcern do
it "still updates the champ" do
expect { fill }.to change { dossier.champs_public.first.value }.from(nil).to(value)
end
it "still marks it as prefilled" do
expect { fill }.to change { dossier.champs_public.first.prefilled }.from(false).to(true)
end
end
end
end