Voodoo here -> spec/features/backoffice/navigate_to_dossier_spec.rb

This commit is contained in:
JC 2017-01-03 12:56:03 +01:00
parent 8d4656cf89
commit a683f86263

View file

@ -1,16 +1,19 @@
require 'spec_helper' require 'spec_helper'
feature 'on backoffice page' do feature 'on backoffice page', js: true do
let(:administrateur) { create(:administrateur) } let(:administrateur) { create(:administrateur) }
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) } let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
let(:procedure) { create(:procedure, administrateur: administrateur) } let(:procedure) { create(:procedure, administrateur: administrateur) }
let(:procedure_individual) { create :procedure, libelle: 'procedure individual', administrateur: administrateur, for_individual: true }
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated') } let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated') }
let!(:dossier_individual) { create :dossier, procedure: procedure_individual, state: 'updated' }
before do before do
create :assign_to, gestionnaire: gestionnaire, procedure: procedure create :assign_to, gestionnaire: gestionnaire, procedure: procedure
create :follow, gestionnaire: gestionnaire, dossier: dossier create :follow, gestionnaire: gestionnaire, dossier: dossier
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_individual
create :follow, gestionnaire: gestionnaire, dossier: dossier_individual
visit backoffice_path visit backoffice_path
end end
@ -18,10 +21,9 @@ feature 'on backoffice page' do
before do before do
page.find_by_id(:user_email).set gestionnaire.email page.find_by_id(:user_email).set gestionnaire.email
page.find_by_id(:user_password).set gestionnaire.password page.find_by_id(:user_password).set gestionnaire.password
page.click_on 'Se connecter' page.click_on 'Se connecter'
end end
context 'when he click on first dossier', js: true do context 'when he click on first dossier' do
before do before do
page.find("#tr_dossier_#{dossier.id}", visible: true).click page.find("#tr_dossier_#{dossier.id}", visible: true).click
end end
@ -30,22 +32,20 @@ feature 'on backoffice page' do
expect(page).to have_css('#backoffice_dossier_show') expect(page).to have_css('#backoffice_dossier_show')
end end
end end
end
context 'when gestionnaire have enterprise and individual dossier in his inbox', js: true do context 'when gestionnaire have enterprise and individual dossier in his inbox', js: true do
let!(:procedure_individual) { create :procedure, libelle: 'procedure individual', administrateur: administrateur, for_individual: true } before do
let!(:dossier_individual) { create :dossier, procedure: procedure_individual, state: 'updated' } page.find_by_id(:user_email).set gestionnaire.email
page.find_by_id(:user_password).set gestionnaire.password
page.click_on 'Se connecter'
before do visit backoffice_dossiers_procedure_path(id: procedure_individual.id)
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_individual page.find("#tr_dossier_#{dossier_individual.id}", visible: true).click
create :follow, gestionnaire: gestionnaire, dossier: dossier_individual end
visit backoffice_dossiers_procedure_path(id: procedure_individual.id) scenario 'it redirect to dossier page' do
page.find("#tr_dossier_#{dossier_individual.id}", visible: true).click expect(page).to have_css('#backoffice_dossier_show')
end
scenario 'it redirect to dossier page' do
expect(page).to have_css('#backoffice_dossier_show')
end
end end
end end
end end