[Fix #1409] Plug identite new design to current workflow
This commit is contained in:
parent
9627ba43c0
commit
3e5621f633
4 changed files with 34 additions and 25 deletions
|
@ -23,7 +23,7 @@ module NewUser
|
|||
if @dossier.procedure.module_api_carto.use_api_carto
|
||||
redirect_to users_dossier_carte_path(@dossier.id)
|
||||
else
|
||||
redirect_to identite_dossier_path(@dossier) # Simon should replace this with dossier_path when done
|
||||
redirect_to users_dossier_description_path(@dossier) # Simon should replace this with dossier_path when done
|
||||
end
|
||||
else
|
||||
flash.now.alert = @dossier.errors.full_messages
|
||||
|
|
|
@ -73,7 +73,11 @@ class Users::DossiersController < UsersController
|
|||
|
||||
update_current_user_siret! siret if siret.present?
|
||||
|
||||
if dossier.procedure.for_individual
|
||||
redirect_to identite_dossier_path(dossier)
|
||||
else
|
||||
redirect_to users_dossier_path(id: dossier.id)
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
error_procedure
|
||||
end
|
||||
|
|
|
@ -13,34 +13,41 @@ feature 'As a User I wanna create a dossier' do
|
|||
before do
|
||||
login_as user, scope: :user
|
||||
visit commencer_path(procedure_path: procedure_for_individual.path)
|
||||
fill_in 'dossier_individual_attributes_nom', with: 'Nom'
|
||||
fill_in 'dossier_individual_attributes_prenom', with: 'Prenom'
|
||||
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
|
||||
fill_in 'individual_nom', with: 'Nom'
|
||||
fill_in 'individual_prenom', with: 'Prenom'
|
||||
check "dossier_autorisation_donnees"
|
||||
end
|
||||
|
||||
context "when birthday is asked" do
|
||||
let(:ask_birthday) { true }
|
||||
|
||||
scenario "with a proper date input field for birthdate (type='date' supported)" do
|
||||
fill_in 'dossier_individual_attributes_birthdate', with: '1987-10-14'
|
||||
page.find_by_id('etape_suivante').click
|
||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||
page.find_by_id('etape_suivante').click
|
||||
fill_in 'individual_birthdate', with: '1987-10-14'
|
||||
click_button('Continuer')
|
||||
|
||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id))
|
||||
click_button('Etape suivante')
|
||||
|
||||
expect(page).to have_current_path(users_dossier_description_path(procedure_for_individual.dossiers.last.id))
|
||||
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
|
||||
find(:css, '[name=submit_action]').set('nouveaux')
|
||||
page.find_by_id('suivant').click
|
||||
click_button('suivant')
|
||||
|
||||
expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14")
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||
end
|
||||
|
||||
scenario "with a basic text input field for birthdate (type='date' unsupported)" do
|
||||
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
|
||||
page.find_by_id('etape_suivante').click
|
||||
fill_in 'individual_birthdate', with: '14/10/1987'
|
||||
click_button('Continuer')
|
||||
|
||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||
page.find_by_id('etape_suivante').click
|
||||
click_button('Etape suivante')
|
||||
|
||||
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
|
||||
find(:css, '[name=submit_action]').set('nouveaux')
|
||||
page.find_by_id('suivant').click
|
||||
|
||||
expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14")
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||
end
|
||||
|
@ -50,12 +57,15 @@ feature 'As a User I wanna create a dossier' do
|
|||
let(:ask_birthday) { false }
|
||||
|
||||
scenario "no need for birthday" do
|
||||
page.find_by_id('etape_suivante').click
|
||||
click_button('Continuer')
|
||||
|
||||
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||
page.find_by_id('etape_suivante').click
|
||||
click_button('Etape suivante')
|
||||
|
||||
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
|
||||
find(:css, '[name=submit_action]').set('nouveaux')
|
||||
page.find_by_id('suivant').click
|
||||
click_button('suivant')
|
||||
|
||||
expect(user.dossiers.first.individual.birthdate).to eq(nil)
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
|
||||
end
|
||||
|
|
|
@ -6,16 +6,11 @@ feature 'As a User I want to sort and paginate dossiers', js: true do
|
|||
|
||||
before "Create dossier" do
|
||||
login_as user, scope: :user
|
||||
visit commencer_path(procedure_path: procedure_for_individual.path)
|
||||
fill_in 'dossier_individual_attributes_nom', with: 'Nom'
|
||||
fill_in 'dossier_individual_attributes_prenom', with: 'Prenom'
|
||||
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
|
||||
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
|
||||
page.find_by_id('etape_suivante').click
|
||||
page.find_by_id('suivant').click
|
||||
|
||||
50.times do
|
||||
Dossier.create(procedure_id: procedure_for_individual.id, user_id: user.id, state: "en_construction")
|
||||
end
|
||||
|
||||
visit root_path
|
||||
end
|
||||
|
||||
|
@ -25,8 +20,8 @@ feature 'As a User I want to sort and paginate dossiers', js: true do
|
|||
expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq(user.dossiers.first.id.to_s)
|
||||
expect(page.all(:css, '#dossiers-list tr')[2].text.split(" ").first).to eq(user.dossiers.second.id.to_s)
|
||||
visit "/users/dossiers?dossiers_smart_listing[sort][id]=desc"
|
||||
expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 50).to_s)
|
||||
expect(page.all(:css, '#dossiers-list tr')[2].text.split(" ").first).to eq((user.dossiers.first.id + 49).to_s)
|
||||
expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 49).to_s)
|
||||
expect(page.all(:css, '#dossiers-list tr')[2].text.split(" ").first).to eq((user.dossiers.first.id + 48).to_s)
|
||||
visit "/users/dossiers?dossiers_smart_listing[sort][id]=asc"
|
||||
expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq(user.dossiers.first.id.to_s)
|
||||
expect(page.all(:css, '#dossiers-list tr')[2].text.split(" ").first).to eq(user.dossiers.second.id.to_s)
|
||||
|
|
Loading…
Reference in a new issue