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 }
|
2017-12-04 16:17:15 +01:00
|
|
|
let(:state) { 'brouillon' }
|
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
|
2017-04-12 11:12:05 +02:00
|
|
|
expect(rendered).to have_selector('#infos-dossiers')
|
2016-12-14 18:41:33 +01:00
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
2017-12-14 15:51:45 +01:00
|
|
|
context 'when dossier state is en_construction' do
|
|
|
|
let(:state) { 'en_construction' }
|
2016-12-14 18:41:33 +01:00
|
|
|
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')
|
2017-04-12 11:12:05 +02:00
|
|
|
expect(rendered).to have_css('#upload-pj-modal')
|
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
|
|
|
|
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
|
|
|
|
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
|
2016-02-08 18:16:18 +01:00
|
|
|
end
|
|
|
|
end
|
2015-09-24 16:51:14 +02:00
|
|
|
end
|
2015-08-25 16:33:55 +02:00
|
|
|
end
|