2015-09-22 15:00:59 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-01-03 12:56:03 +01:00
|
|
|
feature 'on backoffice page', js: true 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) }
|
2017-01-03 12:56:03 +01:00
|
|
|
let(:procedure_individual) { create :procedure, libelle: 'procedure individual', administrateur: administrateur, for_individual: true }
|
2016-12-14 18:41:33 +01:00
|
|
|
|
2016-08-11 15:27:35 +02:00
|
|
|
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated') }
|
2017-01-03 12:56:03 +01:00
|
|
|
let!(:dossier_individual) { create :dossier, procedure: procedure_individual, 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-12-14 18:41:33 +01:00
|
|
|
create :follow, gestionnaire: gestionnaire, dossier: dossier
|
2017-01-03 12:56:03 +01:00
|
|
|
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_individual
|
|
|
|
create :follow, gestionnaire: gestionnaire, dossier: dossier_individual
|
2017-02-13 11:57:35 +01:00
|
|
|
visit users_path
|
2015-09-22 15:00:59 +02:00
|
|
|
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
|
2017-01-03 11:32:21 +01:00
|
|
|
page.find_by_id(:user_email).set gestionnaire.email
|
|
|
|
page.find_by_id(:user_password).set gestionnaire.password
|
2015-09-22 15:00:59 +02:00
|
|
|
page.click_on 'Se connecter'
|
|
|
|
end
|
2017-01-03 12:56:03 +01:00
|
|
|
context 'when he click on first dossier' do
|
2016-08-30 11:18:43 +02:00
|
|
|
before do
|
2016-12-14 18:53:40 +01:00
|
|
|
page.find("#tr_dossier_#{dossier.id}", visible: true).click
|
2016-08-30 11:18:43 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'it redirect to dossier page' do
|
2017-04-12 11:12:05 +02:00
|
|
|
expect(page).to have_css('#backoffice-dossier-show')
|
2016-08-30 11:18:43 +02:00
|
|
|
end
|
|
|
|
end
|
2017-01-03 12:56:03 +01:00
|
|
|
end
|
2016-12-14 18:41:33 +01:00
|
|
|
|
2017-01-03 12:56:03 +01:00
|
|
|
context 'when gestionnaire have enterprise and individual dossier in his inbox', js: true do
|
|
|
|
before do
|
|
|
|
page.find_by_id(:user_email).set gestionnaire.email
|
|
|
|
page.find_by_id(:user_password).set gestionnaire.password
|
|
|
|
page.click_on 'Se connecter'
|
2016-12-14 18:41:33 +01:00
|
|
|
|
2017-01-03 12:56:03 +01:00
|
|
|
visit backoffice_dossiers_procedure_path(id: procedure_individual.id)
|
|
|
|
page.find("#tr_dossier_#{dossier_individual.id}", visible: true).click
|
|
|
|
end
|
2016-12-14 18:41:33 +01:00
|
|
|
|
2017-01-03 12:56:03 +01:00
|
|
|
scenario 'it redirect to dossier page' do
|
2017-04-12 11:12:05 +02:00
|
|
|
expect(page).to have_css('#backoffice-dossier-show')
|
2016-12-14 18:41:33 +01:00
|
|
|
end
|
2015-09-22 15:00:59 +02:00
|
|
|
end
|
2016-12-20 17:26:46 +01:00
|
|
|
end
|