2015-11-13 15:23:21 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
feature 'on click on tabs button' do
|
|
|
|
let(:administrateur) { create(:administrateur) }
|
2016-05-20 15:39:17 +02:00
|
|
|
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
|
2015-11-13 15:23:21 +01:00
|
|
|
|
2016-08-22 16:10:48 +02:00
|
|
|
let(:procedure) { create :procedure, administrateur: administrateur }
|
|
|
|
|
2015-11-13 15:23:21 +01:00
|
|
|
before do
|
2016-08-22 16:10:48 +02:00
|
|
|
create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated')
|
|
|
|
create(:dossier, :with_entreprise, procedure: procedure, state: 'replied')
|
|
|
|
create(:dossier, :with_entreprise, procedure: procedure, state: 'updated')
|
|
|
|
create(:dossier, :with_entreprise, procedure: procedure, state: 'validated')
|
|
|
|
create(:dossier, :with_entreprise, procedure: procedure, state: 'submitted')
|
|
|
|
create(:dossier, :with_entreprise, procedure: procedure, state: 'received')
|
|
|
|
create(:dossier, :with_entreprise, procedure: procedure, state: 'closed')
|
|
|
|
create(:dossier, :with_entreprise, procedure: procedure, state: 'refused')
|
|
|
|
create(:dossier, :with_entreprise, procedure: procedure, state: 'without_continuation')
|
|
|
|
|
|
|
|
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
|
|
|
|
2015-11-13 15:23:21 +01:00
|
|
|
login_as gestionnaire, scope: :gestionnaire
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when gestionnaire is logged in' do
|
2016-08-11 15:27:35 +02:00
|
|
|
context 'when he click on tabs nouveaux' do
|
|
|
|
before do
|
|
|
|
visit backoffice_dossiers_url(liste: :nouveaux)
|
2016-08-22 16:10:48 +02:00
|
|
|
page.click_on 'Nouveaux 1'
|
2016-08-11 15:27:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'it redirect to backoffice dossier termine' do
|
|
|
|
expect(page).to have_css('#backoffice_index')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when he click on tabs a traite' do
|
2015-11-13 15:23:21 +01:00
|
|
|
before do
|
2015-12-02 18:03:52 +01:00
|
|
|
visit backoffice_dossiers_url(liste: :a_traiter)
|
2016-11-10 15:57:14 +01:00
|
|
|
page.click_on 'Ouverts 2'
|
2015-11-13 15:23:21 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'it redirect to backoffice dossier termine' do
|
2015-12-02 18:03:52 +01:00
|
|
|
expect(page).to have_css('#backoffice_index')
|
2015-11-13 15:23:21 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when he click on tabs en attente' do
|
|
|
|
before do
|
2016-11-10 15:57:14 +01:00
|
|
|
visit backoffice_dossiers_url(liste: :figes)
|
|
|
|
page.click_on 'Figés 1'
|
2015-11-13 15:23:21 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'it redirect to backoffice dossier en attente' do
|
2015-12-02 18:03:52 +01:00
|
|
|
expect(page).to have_css('#backoffice_index')
|
2015-11-13 15:23:21 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-08-11 15:27:35 +02:00
|
|
|
context 'when he click on tabs a receptionner' do
|
|
|
|
before do
|
2016-08-22 16:10:48 +02:00
|
|
|
visit backoffice_dossiers_url(liste: :deposes)
|
|
|
|
page.click_on 'À réceptionner 1'
|
2016-08-11 15:27:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'it redirect to backoffice dossier a_receptionner' do
|
|
|
|
expect(page).to have_css('#backoffice_index')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when he click on tabs a instruire' do
|
|
|
|
before do
|
|
|
|
visit backoffice_dossiers_url(liste: :a_instruire)
|
2016-08-22 16:10:48 +02:00
|
|
|
page.click_on 'À instruire 1'
|
2016-08-11 15:27:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'it redirect to backoffice dossier termine' do
|
|
|
|
expect(page).to have_css('#backoffice_index')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-11-13 15:23:21 +01:00
|
|
|
context 'when he click on tabs termine' do
|
|
|
|
before do
|
2015-12-02 18:03:52 +01:00
|
|
|
visit backoffice_dossiers_url(liste: :termine)
|
2016-08-22 16:10:48 +02:00
|
|
|
page.click_on 'Terminé 3'
|
2015-11-13 15:23:21 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'it redirect to backoffice dossier termine' do
|
2015-12-02 18:03:52 +01:00
|
|
|
expect(page).to have_css('#backoffice_index')
|
2015-11-13 15:23:21 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-10-18 15:51:32 +02:00
|
|
|
|
|
|
|
context "OpenSimplif" do
|
|
|
|
before do
|
|
|
|
allow(Features).to receive(:opensimplif).and_return(true)
|
|
|
|
visit backoffice_dossiers_url
|
|
|
|
end
|
|
|
|
|
|
|
|
scenario "it hides the tabs" do
|
2016-10-24 16:05:41 +02:00
|
|
|
expect(page).to_not have_content('Nouveaux')
|
2016-10-18 15:51:32 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|