improve factories

Co-authored-by: mfo <mfo@users.noreply.github.com>
This commit is contained in:
Christophe Robillard 2024-10-25 15:32:33 +02:00 committed by mfo
parent 15cea714c1
commit 9530099d23
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC
3 changed files with 8 additions and 3 deletions

View file

@ -170,15 +170,20 @@ FactoryBot.define do
factory :champ_do_not_use_rna, class: 'Champs::RNAChamp' do factory :champ_do_not_use_rna, class: 'Champs::RNAChamp' do
value { 'W173847273' } value { 'W173847273' }
value_json { AddressProxy::ADDRESS_PARTS.index_by(&:itself) }
end end
factory :champ_do_not_use_engagement_juridique, class: 'Champs::EngagementJuridiqueChamp' do factory :champ_do_not_use_engagement_juridique, class: 'Champs::EngagementJuridiqueChamp' do
value { 'EJ' }
end end
factory :champ_do_not_use_cojo, class: 'Champs::COJOChamp' do factory :champ_do_not_use_cojo, class: 'Champs::COJOChamp' do
end end
factory :champ_do_not_use_rnf, class: 'Champs::RNFChamp' do factory :champ_do_not_use_rnf, class: 'Champs::RNFChamp' do
value { '075-FDD-00003-01' }
external_id { '075-FDD-00003-01' }
value_json { AddressProxy::ADDRESS_PARTS.index_by(&:itself) }
end end
factory :champ_do_not_use_expression_reguliere, class: 'Champs::ExpressionReguliereChamp' do factory :champ_do_not_use_expression_reguliere, class: 'Champs::ExpressionReguliereChamp' do

View file

@ -20,7 +20,7 @@ module Maintenance
end end
it 'updates value_json' do it 'updates value_json' do
expect { subject }.to change { element.reload.value_json } expect { subject }.to change { element.reload.value_json }
.from(nil) .from(anything)
.to({ .to({
"street_number" => "33", "street_number" => "33",
"street_name" => "de Modagor", "street_name" => "de Modagor",

View file

@ -53,7 +53,7 @@ module Maintenance
it 'updates value_json' do it 'updates value_json' do
expect { subject }.to change { element.reload.value_json } expect { subject }.to change { element.reload.value_json }
.from(nil) .from(anything)
.to({ .to({
"street_number" => "16", "street_number" => "16",
"street_name" => "Rue du Général de Boissieu", "street_name" => "Rue du Général de Boissieu",
@ -79,7 +79,7 @@ module Maintenance
it 'updates value_json' do it 'updates value_json' do
expect { subject }.to change { element.reload.value_json } expect { subject }.to change { element.reload.value_json }
.from(nil) .from(anything)
.to({ .to({
"street_number" => "16", "street_number" => "16",
"street_name" => "Rue du Général de Boissieu", "street_name" => "Rue du Général de Boissieu",