refactor(spec): champs_* -> project_champs_*

This commit is contained in:
Paul Chavard 2024-09-27 15:37:11 +02:00
parent ecbf985147
commit 7a39267473
No known key found for this signature in database
44 changed files with 254 additions and 265 deletions

View file

@ -515,7 +515,7 @@ describe API::V2::GraphqlController do
avis: []
)
expected_champs = dossier.champs_public.map do |champ|
expected_champs = dossier.project_champs_public.map do |champ|
{
id: champ.to_typed_id,
label: champ.libelle,
@ -546,7 +546,7 @@ describe API::V2::GraphqlController do
end
expect(gql_data[:dossier][:messages]).to match_array(expected_messages)
expect(gql_data[:dossier][:champs][0][:id]).to eq(dossier.champs_public[0].type_de_champ.to_typed_id)
expect(gql_data[:dossier][:champs][0][:id]).to eq(dossier.project_champs_public[0].type_de_champ.to_typed_id)
end
end
@ -687,8 +687,8 @@ describe API::V2::GraphqlController do
context "champs" do
let(:procedure) { create(:procedure, :published, :for_individual, administrateurs: [admin], types_de_champ_public: [{ type: :date }, { type: :datetime }]) }
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
let(:champ_date) { dossier.champs_public.first }
let(:champ_datetime) { dossier.champs_public.second }
let(:champ_date) { dossier.project_champs_public.first }
let(:champ_datetime) { dossier.project_champs_public.second }
before do
champ_date.update(value: '2019-07-10')
@ -1243,7 +1243,7 @@ describe API::V2::GraphqlController do
"mutation {
dossierModifierAnnotationText(input: {
dossierId: \"#{dossier.to_typed_id}\",
annotationId: \"#{dossier.champs_private.find { |c| c.type == 'Champs::TextChamp' }.to_typed_id}\",
annotationId: \"#{dossier.project_champs_private.find { |c| c.type == 'Champs::TextChamp' }.to_typed_id}\",
instructeurId: \"#{instructeur.to_typed_id}\",
value: \"hello\"
}) {
@ -1280,7 +1280,7 @@ describe API::V2::GraphqlController do
"mutation {
dossierModifierAnnotationCheckbox(input: {
dossierId: \"#{dossier.to_typed_id}\",
annotationId: \"#{dossier.champs_private.find { |c| c.type_champ == 'checkbox' }.to_typed_id}\",
annotationId: \"#{dossier.project_champs_private.find { |c| c.type_champ == 'checkbox' }.to_typed_id}\",
instructeurId: \"#{instructeur.to_typed_id}\",
value: #{value}
}) {
@ -1331,7 +1331,7 @@ describe API::V2::GraphqlController do
"mutation {
dossierModifierAnnotationCheckbox(input: {
dossierId: \"#{dossier.to_typed_id}\",
annotationId: \"#{dossier.champs_private.find { |c| c.type_champ == 'yes_no' }.to_typed_id}\",
annotationId: \"#{dossier.project_champs_private.find { |c| c.type_champ == 'yes_no' }.to_typed_id}\",
instructeurId: \"#{instructeur.to_typed_id}\",
value: #{value}
}) {
@ -1381,7 +1381,7 @@ describe API::V2::GraphqlController do
"mutation {
dossierModifierAnnotationDate(input: {
dossierId: \"#{dossier.to_typed_id}\",
annotationId: \"#{dossier.champs_private.find { |c| c.type_champ == 'date' }.to_typed_id}\",
annotationId: \"#{dossier.project_champs_private.find { |c| c.type_champ == 'date' }.to_typed_id}\",
instructeurId: \"#{instructeur.to_typed_id}\",
value: \"#{1.day.from_now.to_date.iso8601}\"
}) {
@ -1401,7 +1401,7 @@ describe API::V2::GraphqlController do
expect(gql_data).to eq(dossierModifierAnnotationDate: {
annotation: {
stringValue: dossier.reload.champs_private.find { |c| c.type_champ == 'date' }.to_s
stringValue: dossier.reload.project_champs_private.find { |c| c.type_champ == 'date' }.to_s
},
errors: nil
})
@ -1416,7 +1416,7 @@ describe API::V2::GraphqlController do
"mutation {
dossierModifierAnnotationDatetime(input: {
dossierId: \"#{dossier.to_typed_id}\",
annotationId: \"#{dossier.champs_private.find { |c| c.type_champ == 'datetime' }.to_typed_id}\",
annotationId: \"#{dossier.project_champs_private.find { |c| c.type_champ == 'datetime' }.to_typed_id}\",
instructeurId: \"#{instructeur.to_typed_id}\",
value: \"#{1.day.from_now.iso8601}\"
}) {
@ -1436,7 +1436,7 @@ describe API::V2::GraphqlController do
expect(gql_data).to eq(dossierModifierAnnotationDatetime: {
annotation: {
stringValue: dossier.reload.champs_private.find { |c| c.type_champ == 'datetime' }.to_s
stringValue: dossier.reload.project_champs_private.find { |c| c.type_champ == 'datetime' }.to_s
},
errors: nil
})
@ -1451,7 +1451,7 @@ describe API::V2::GraphqlController do
"mutation {
dossierModifierAnnotationDropDownList(input: {
dossierId: \"#{dossier.to_typed_id}\",
annotationId: \"#{dossier.champs_private.find { |c| c.type_champ == 'drop_down_list' }.to_typed_id}\",
annotationId: \"#{dossier.project_champs_private.find { |c| c.type_champ == 'drop_down_list' }.to_typed_id}\",
instructeurId: \"#{instructeur.to_typed_id}\",
value: \"#{value}\"
}) {
@ -1472,7 +1472,7 @@ describe API::V2::GraphqlController do
expect(gql_data).to eq(dossierModifierAnnotationDropDownList: {
annotation: {
stringValue: dossier.reload.champs_private.find { |c| c.type_champ == 'drop_down_list' }.to_s
stringValue: dossier.reload.project_champs_private.find { |c| c.type_champ == 'drop_down_list' }.to_s
},
errors: nil
})
@ -1497,7 +1497,7 @@ describe API::V2::GraphqlController do
"mutation {
dossierModifierAnnotationIntegerNumber(input: {
dossierId: \"#{dossier.to_typed_id}\",
annotationId: \"#{dossier.champs_private.find { |c| c.type_champ == 'integer_number' }.to_typed_id}\",
annotationId: \"#{dossier.project_champs_private.find { |c| c.type_champ == 'integer_number' }.to_typed_id}\",
instructeurId: \"#{instructeur.to_typed_id}\",
value: 42
}) {