2015-08-25 16:33:55 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-09-24 11:37:18 +02:00
|
|
|
describe 'users/recapitulatif/show.html.haml', type: :view do
|
2016-10-05 14:28:10 +02:00
|
|
|
let(:dossier) { create(:dossier, :with_entreprise, state: state, procedure: create(:procedure, :with_api_carto, :with_two_type_de_piece_justificative, for_individual: true, individual_with_siret: true)) }
|
2015-09-24 11:37:18 +02:00
|
|
|
let(:dossier_id) { dossier.id }
|
2015-12-24 15:10:20 +01:00
|
|
|
let(:state) { 'draft' }
|
2015-09-24 11:37:18 +02:00
|
|
|
|
2015-08-25 16:33:55 +02:00
|
|
|
before do
|
2016-02-08 18:16:18 +01:00
|
|
|
sign_in dossier.user
|
2015-12-24 15:10:20 +01:00
|
|
|
assign(:facade, DossierFacades.new(dossier.id, dossier.user.email))
|
2015-08-25 16:33:55 +02:00
|
|
|
end
|
2015-09-24 12:04:44 +02:00
|
|
|
|
2015-09-24 11:37:18 +02:00
|
|
|
context 'sur la rendered recapitulative' do
|
2015-09-24 16:51:14 +02:00
|
|
|
context 'test de composition de la page' do
|
|
|
|
before do
|
|
|
|
render
|
|
|
|
end
|
2015-09-24 12:04:44 +02:00
|
|
|
|
2015-09-24 16:51:14 +02:00
|
|
|
it 'la section infos dossier est présente' do
|
2016-12-14 18:41:33 +01:00
|
|
|
expect(rendered).to have_selector('#infos_dossier')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'le flux de commentaire est présent' do
|
|
|
|
expect(rendered).to have_selector('#messages')
|
2015-09-24 16:51:14 +02:00
|
|
|
end
|
2015-09-24 12:04:44 +02:00
|
|
|
|
2015-09-24 16:51:14 +02:00
|
|
|
it 'le numéro de dossier est présent' do
|
2016-12-14 18:41:33 +01:00
|
|
|
pending 'move to test layout'
|
|
|
|
expect(rendered).to have_selector('#dossier_id')
|
2015-09-24 16:51:14 +02:00
|
|
|
expect(rendered).to have_content(dossier_id)
|
|
|
|
end
|
|
|
|
|
2016-02-08 18:16:18 +01:00
|
|
|
describe 'les liens de modifications' do
|
2015-09-24 16:51:14 +02:00
|
|
|
context 'lien description' do
|
|
|
|
it 'le lien vers description est présent' do
|
|
|
|
expect(rendered).to have_css('#maj_infos')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'le lien vers description est correct' do
|
2015-11-19 16:47:56 +01:00
|
|
|
expect(rendered).to have_selector("a[id=maj_infos][href='/users/dossiers/#{dossier_id}/description']")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-12-14 18:41:33 +01:00
|
|
|
context 'lien carte' do
|
|
|
|
it 'le lien vers carte est présent' do
|
2016-09-14 16:36:01 +02:00
|
|
|
expect(rendered).to have_css('#maj_pj')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-12-14 18:41:33 +01:00
|
|
|
context 'lien carte' do
|
2016-10-05 14:28:10 +02:00
|
|
|
it 'le lien vers le renseignement un SIRET est présent' do
|
|
|
|
expect(rendered).to have_css('#add_siret')
|
|
|
|
end
|
|
|
|
end
|
2016-03-22 17:36:36 +01:00
|
|
|
|
2016-12-14 18:41:33 +01:00
|
|
|
context 'lien carte' do
|
|
|
|
it 'le lien vers carte est présent' do
|
|
|
|
pending 'map: later'
|
|
|
|
expect(rendered).to have_css('#maj_carte')
|
|
|
|
end
|
2015-09-24 16:51:14 +02:00
|
|
|
|
2016-12-14 18:41:33 +01:00
|
|
|
it 'le lien vers description est correct' do
|
|
|
|
pending 'map: later'
|
|
|
|
expect(rendered).to have_selector("a[id=maj_carte][href='/users/dossiers/#{dossier_id}/carte']")
|
|
|
|
end
|
2015-09-24 16:51:14 +02:00
|
|
|
end
|
|
|
|
end
|
2016-12-14 18:41:33 +01:00
|
|
|
end
|
2015-09-24 16:51:14 +02:00
|
|
|
|
2016-12-14 18:41:33 +01:00
|
|
|
context 'when dossier state is initiated' do
|
|
|
|
let(:state) { 'initiated' }
|
|
|
|
before do
|
|
|
|
render
|
2016-08-11 15:27:35 +02:00
|
|
|
end
|
|
|
|
|
2016-12-14 18:41:33 +01:00
|
|
|
it 'button Modifier les document est present' do
|
|
|
|
expect(rendered).to have_content('Modifier les documents')
|
|
|
|
expect(rendered).to have_css('#UploadPJmodal')
|
2016-08-11 15:27:35 +02:00
|
|
|
end
|
|
|
|
|
2015-09-24 16:51:14 +02:00
|
|
|
end
|
2016-02-08 18:16:18 +01:00
|
|
|
|
|
|
|
context 'when invite is logged' do
|
|
|
|
|
2016-09-14 16:36:01 +02:00
|
|
|
context 'when invite is by Gestionnaire' do
|
|
|
|
let!(:invite_user) { create(:user, email: 'invite@octo.com') }
|
2016-02-08 18:16:18 +01:00
|
|
|
|
2016-09-14 16:36:01 +02:00
|
|
|
before do
|
|
|
|
create(:invite) { create(:invite, email: invite_user.email, user: invite_user, dossier: dossier) }
|
|
|
|
sign_out dossier.user
|
|
|
|
sign_in invite_user
|
|
|
|
render
|
|
|
|
end
|
2016-02-08 18:16:18 +01:00
|
|
|
|
2016-09-14 16:36:01 +02:00
|
|
|
describe 'les liens de modifications' do
|
|
|
|
it 'describe link is not present' do
|
|
|
|
expect(rendered).not_to have_css('#maj_infos')
|
|
|
|
end
|
2016-02-08 18:16:18 +01:00
|
|
|
|
2016-09-14 16:36:01 +02:00
|
|
|
it 'map link is not present' do
|
|
|
|
expect(rendered).not_to have_css('#maj_carte')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'PJ link is not present' do
|
|
|
|
expect(rendered).not_to have_css('#maj_pj')
|
|
|
|
end
|
2016-02-08 18:16:18 +01:00
|
|
|
|
2016-09-14 16:36:01 +02:00
|
|
|
it 'archive link is not present' do
|
|
|
|
expect(rendered).not_to have_content('Archiver')
|
|
|
|
end
|
2016-02-08 18:16:18 +01:00
|
|
|
end
|
|
|
|
|
2016-09-14 16:36:01 +02:00
|
|
|
context 'when dossier is validated' do
|
|
|
|
let(:state) { 'validated' }
|
|
|
|
|
|
|
|
before do
|
|
|
|
render
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'submitted link is not present' do
|
2016-11-25 10:46:08 +01:00
|
|
|
expect(rendered).not_to have_content('Procéder au dépôt définitif')
|
2016-09-14 16:36:01 +02:00
|
|
|
end
|
2016-02-08 18:16:18 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-09-14 16:36:01 +02:00
|
|
|
context 'invite is by User' do
|
|
|
|
let!(:invite_user) { create(:user, email: 'invite@octo.com') }
|
2016-02-08 18:16:18 +01:00
|
|
|
|
|
|
|
before do
|
2016-09-14 16:36:01 +02:00
|
|
|
create(:invite) { create(:invite, email: invite_user.email, user: invite_user, dossier: dossier, type: 'InviteUser') }
|
|
|
|
sign_out dossier.user
|
|
|
|
sign_in invite_user
|
2016-02-08 18:16:18 +01:00
|
|
|
render
|
|
|
|
end
|
|
|
|
|
2016-09-14 16:36:01 +02:00
|
|
|
describe 'les liens de modifications' do
|
|
|
|
it 'describe link is not present' do
|
|
|
|
expect(rendered).to have_css('#maj_infos')
|
|
|
|
end
|
|
|
|
|
2016-12-14 18:41:33 +01:00
|
|
|
it 'map link is present' do
|
|
|
|
pending 'map: later'
|
|
|
|
expect(rendered).to have_css('#maj_carte')
|
|
|
|
end
|
|
|
|
|
2016-09-14 16:36:01 +02:00
|
|
|
it 'PJ link is present' do
|
|
|
|
expect(rendered).to have_css('#maj_pj')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'archive link is present' do
|
|
|
|
expect(rendered).not_to have_content('Archiver')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when dossier is validated' do
|
|
|
|
let(:state) { 'validated' }
|
|
|
|
|
|
|
|
before do
|
|
|
|
render
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'submitted link is not present' do
|
2016-11-25 10:46:08 +01:00
|
|
|
expect(rendered).not_to have_content('Procéder au dépôt définitif')
|
2016-09-14 16:36:01 +02:00
|
|
|
end
|
2016-02-08 18:16:18 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-09-24 16:51:14 +02:00
|
|
|
end
|
2015-08-25 16:33:55 +02:00
|
|
|
end
|