Merge pull request #8636 from tchak/fix-graphql-demarche-lien
fix(graphql): fix demarcheUrl
This commit is contained in:
commit
0416ea0453
4 changed files with 8 additions and 2 deletions
|
@ -288,6 +288,7 @@ class API::V2::StoredQuery
|
||||||
dateFermeture
|
dateFermeture
|
||||||
notice { url }
|
notice { url }
|
||||||
deliberation { url }
|
deliberation { url }
|
||||||
|
demarcheUrl
|
||||||
cadreJuridiqueUrl
|
cadreJuridiqueUrl
|
||||||
service @include(if: $includeService) {
|
service @include(if: $includeService) {
|
||||||
...ServiceFragment
|
...ServiceFragment
|
||||||
|
|
|
@ -75,7 +75,11 @@ Cela évite l’accès récursif aux dossiers."
|
||||||
delegate :description, :opendata, :tags, to: :procedure
|
delegate :description, :opendata, :tags, to: :procedure
|
||||||
|
|
||||||
def demarche_url
|
def demarche_url
|
||||||
procedure.lien_demarche
|
if procedure.brouillon?
|
||||||
|
Rails.application.routes.url_helpers.commencer_test_url(path: procedure.path)
|
||||||
|
else
|
||||||
|
Rails.application.routes.url_helpers.commencer_url(path: procedure.path)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def dpo_url
|
def dpo_url
|
||||||
|
|
|
@ -138,6 +138,7 @@ describe API::V2::GraphqlController do
|
||||||
it {
|
it {
|
||||||
expect(gql_errors).to be_nil
|
expect(gql_errors).to be_nil
|
||||||
expect(gql_data[:demarcheDescriptor][:id]).to eq(procedure.to_typed_id)
|
expect(gql_data[:demarcheDescriptor][:id]).to eq(procedure.to_typed_id)
|
||||||
|
expect(gql_data[:demarcheDescriptor][:demarcheUrl]).to match("commencer/#{procedure.path}")
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe DemarchesPubliquesExportService do
|
||||||
typeOrganisme: "association"
|
typeOrganisme: "association"
|
||||||
},
|
},
|
||||||
cadreJuridiqueUrl: "un cadre juridique important",
|
cadreJuridiqueUrl: "un cadre juridique important",
|
||||||
demarcheUrl: nil,
|
demarcheUrl: Rails.application.routes.url_helpers.commencer_url(path: procedure.path),
|
||||||
dpoUrl: nil,
|
dpoUrl: nil,
|
||||||
noticeUrl: nil,
|
noticeUrl: nil,
|
||||||
siteWebUrl: "https://mon-site.gouv",
|
siteWebUrl: "https://mon-site.gouv",
|
||||||
|
|
Loading…
Reference in a new issue