2015-09-22 15:00:59 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
feature 'on backoffice page' do
|
2015-11-10 11:58:56 +01:00
|
|
|
let(:administrateur) { create(:administrateur) }
|
2016-05-20 15:39:17 +02:00
|
|
|
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
|
2015-11-10 11:58:56 +01:00
|
|
|
let(:procedure) { create(:procedure, administrateur: administrateur) }
|
|
|
|
|
2016-08-11 15:27:35 +02:00
|
|
|
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated') }
|
2016-05-20 15:39:17 +02:00
|
|
|
|
2015-09-22 15:00:59 +02:00
|
|
|
before do
|
2016-05-20 15:39:17 +02:00
|
|
|
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
2016-08-01 18:10:32 +02:00
|
|
|
|
2015-09-22 15:00:59 +02:00
|
|
|
visit backoffice_path
|
|
|
|
end
|
2016-05-20 15:39:17 +02:00
|
|
|
|
2015-09-22 15:00:59 +02:00
|
|
|
context 'when gestionnaire is logged in' do
|
|
|
|
before do
|
2015-11-10 11:58:56 +01:00
|
|
|
page.find_by_id(:gestionnaire_email).set gestionnaire.email
|
|
|
|
page.find_by_id(:gestionnaire_password).set gestionnaire.password
|
2016-08-11 15:27:35 +02:00
|
|
|
|
2015-09-22 15:00:59 +02:00
|
|
|
page.click_on 'Se connecter'
|
|
|
|
end
|
|
|
|
context 'when he click on first dossier' do
|
|
|
|
before do
|
2016-08-02 14:49:41 +02:00
|
|
|
page.click_on dossier.id
|
2015-09-22 15:00:59 +02:00
|
|
|
end
|
2016-08-11 15:27:35 +02:00
|
|
|
|
2015-09-22 15:00:59 +02:00
|
|
|
scenario 'it redirect to dossier page' do
|
|
|
|
expect(page).to have_css('#backoffice_dossier_show')
|
|
|
|
end
|
|
|
|
end
|
2016-08-30 11:18:43 +02:00
|
|
|
|
|
|
|
context 'when gestionnaire have enterprise and individual dossier in his inbox' do
|
|
|
|
let!(:procedure_individual) { create :procedure, libelle: 'procedure individual', administrateur: administrateur, for_individual: true }
|
|
|
|
let!(:dossier_individual) { create :dossier, procedure: procedure_individual, state: 'updated' }
|
|
|
|
|
|
|
|
before do
|
|
|
|
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_individual
|
|
|
|
|
|
|
|
visit backoffice_path
|
|
|
|
page.click_on dossier_individual.id
|
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'it redirect to dossier page' do
|
|
|
|
expect(page).to have_css('#backoffice_dossier_show')
|
|
|
|
end
|
|
|
|
end
|
2015-09-22 15:00:59 +02:00
|
|
|
end
|
|
|
|
end
|