2023-03-06 15:51:08 +01:00
|
|
|
describe 'users/dossiers/identite', type: :view do
|
2020-01-07 17:50:49 +01:00
|
|
|
let(:dossier) { create(:dossier, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
|
2018-06-19 16:23:43 +02:00
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in dossier.user
|
|
|
|
assign(:dossier, dossier)
|
|
|
|
end
|
|
|
|
|
2019-01-07 12:17:11 +01:00
|
|
|
subject! { render }
|
2018-06-19 16:23:43 +02:00
|
|
|
|
2024-04-18 11:28:49 +02:00
|
|
|
context 'when procedure has for_tiers_enabled' do
|
|
|
|
let(:procedure) { create(:simple_procedure, :for_individual) }
|
|
|
|
|
|
|
|
it 'has choice for you or a tiers' do
|
|
|
|
expect(rendered).to have_content "Pour vous"
|
|
|
|
expect(rendered).to have_content "Pour un bénéficiaire : membre de la famille, proche, mandant, professionnel en charge du suivi du dossier…"
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has identity fields' do
|
|
|
|
within('.individual-infos') do
|
|
|
|
expect(rendered).to have_field(id: 'Prenom')
|
|
|
|
expect(rendered).to have_field(id: 'Nom')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when the demarche asks for the birthdate' do
|
|
|
|
let(:procedure) { create(:simple_procedure, for_individual: true, ask_birthday: true) }
|
|
|
|
|
|
|
|
it 'has a birthday field' do
|
|
|
|
expect(rendered).to have_field('Date de naissance')
|
|
|
|
end
|
2023-11-28 12:43:43 +01:00
|
|
|
end
|
2019-01-07 12:17:11 +01:00
|
|
|
end
|
|
|
|
|
2024-04-18 11:28:49 +02:00
|
|
|
context 'when procedure has for_tiers_enabled' do
|
|
|
|
let(:procedure) { create(:simple_procedure, :for_individual, for_tiers_enabled: false) }
|
|
|
|
|
|
|
|
it 'has choice for you or a tiers' do
|
|
|
|
expect(rendered).not_to have_content "Pour vous"
|
|
|
|
expect(rendered).not_to have_content "Pour un bénéficiaire : membre de la famille, proche, mandant, professionnel en charge du suivi du dossier…"
|
|
|
|
end
|
2018-06-19 16:23:43 +02:00
|
|
|
|
2024-04-18 11:28:49 +02:00
|
|
|
it 'has identity fields' do
|
|
|
|
within('.individual-infos') do
|
|
|
|
expect(rendered).to have_field(id: 'Prenom')
|
|
|
|
expect(rendered).to have_field(id: 'Nom')
|
|
|
|
end
|
2018-06-19 16:23:43 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|