First tests for prefill repetition
This commit is contained in:
parent
e7c78321d9
commit
63e7c17fda
8 changed files with 47 additions and 7 deletions
|
@ -6,8 +6,14 @@ describe 'Prefilling a dossier (with a POST request):' do
|
|||
|
||||
let(:type_de_champ_text) { create(:type_de_champ_text, procedure: procedure) }
|
||||
let(:type_de_champ_phone) { create(:type_de_champ_phone, procedure: procedure) }
|
||||
let(:type_de_champ_repetition) { create(:type_de_champ_repetition, :with_types_de_champ, procedure: procedure) }
|
||||
let(:text_value) { "My Neighbor Totoro is the best movie ever" }
|
||||
let(:phone_value) { "invalid phone value" }
|
||||
let(:sub_type_de_champs_repetition) { type_de_champ_repetition.active_revision_type_de_champ.revision_types_de_champ.map(&:type_de_champ) }
|
||||
let(:text_repetition_libelle) { sub_type_de_champs_repetition.first.libelle }
|
||||
let(:integer_repetition_libelle) { sub_type_de_champs_repetition.second.libelle }
|
||||
let(:text_repetition_value) { "First repetition text" }
|
||||
let(:integer_repetition_value) { "42" }
|
||||
|
||||
scenario "the user get the URL of a prefilled orphan brouillon dossier" do
|
||||
dossier_url = create_and_prefill_dossier_with_post_request
|
||||
|
@ -95,7 +101,13 @@ describe 'Prefilling a dossier (with a POST request):' do
|
|||
headers: { "Content-Type" => "application/json" },
|
||||
params: {
|
||||
"champ_#{type_de_champ_text.to_typed_id}" => text_value,
|
||||
"champ_#{type_de_champ_phone.to_typed_id}" => phone_value
|
||||
"champ_#{type_de_champ_phone.to_typed_id}" => phone_value,
|
||||
"champ_#{type_de_champ_repetition.to_typed_id}" => [
|
||||
"{
|
||||
\"#{sub_type_de_champs_repetition.first.libelle}\": \"#{text_repetition_value}\",
|
||||
\"#{sub_type_de_champs_repetition.second.libelle}\": \"#{integer_repetition_value}\"
|
||||
}"
|
||||
]
|
||||
}.to_json
|
||||
JSON.parse(session.response.body)["dossier_url"].gsub("http://www.example.com", "")
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue