Rename gestionnaire in code to instructeur

This commit is contained in:
simon lehericey 2019-08-06 11:02:54 +02:00
parent 6902f84b85
commit 3fde2a6f70
175 changed files with 1162 additions and 1162 deletions

View file

@ -45,7 +45,7 @@ describe AdministrateurUsageStatisticsService do
active: true,
features: { holy_hand_grenade_of_antioch: true },
services: [create(:service)],
gestionnaires: [create(:gestionnaire)])
instructeurs: [create(:instructeur)])
end
it do

View file

@ -1,22 +1,22 @@
require 'spec_helper'
describe DossierSearchService do
describe '#matching_dossiers_for_gestionnaire' do
describe '#matching_dossiers_for_instructeur' do
subject { liste_dossiers }
let(:liste_dossiers) do
described_class.matching_dossiers_for_gestionnaire(terms, gestionnaire_1)
described_class.matching_dossiers_for_instructeur(terms, instructeur_1)
end
let(:administrateur_1) { create(:administrateur) }
let(:administrateur_2) { create(:administrateur) }
let(:gestionnaire_1) { create(:gestionnaire, administrateurs: [administrateur_1]) }
let(:gestionnaire_2) { create(:gestionnaire, administrateurs: [administrateur_2]) }
let(:instructeur_1) { create(:instructeur, administrateurs: [administrateur_1]) }
let(:instructeur_2) { create(:instructeur, administrateurs: [administrateur_2]) }
before do
create :assign_to, gestionnaire: gestionnaire_1, procedure: procedure_1
create :assign_to, gestionnaire: gestionnaire_2, procedure: procedure_2
create :assign_to, instructeur: instructeur_1, procedure: procedure_1
create :assign_to, instructeur: instructeur_2, procedure: procedure_2
end
let(:procedure_1) { create(:procedure, :published, administrateur: administrateur_1) }

View file

@ -1,40 +1,40 @@
describe NotificationService do
describe '.send_gestionnaire_email_notification' do
describe '.send_instructeur_email_notification' do
let(:procedure) { create(:procedure) }
before do
allow(GestionnaireMailer).to receive(:send_notifications)
allow(InstructeurMailer).to receive(:send_notifications)
.and_return(double(deliver_later: true))
end
subject { NotificationService.send_gestionnaire_email_notification }
subject { NotificationService.send_instructeur_email_notification }
context 'when a gestionnaire does not enable its email notification' do
context 'when a instructeur does not enable its email notification' do
let!(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
let(:gestionnaire) { create(:gestionnaire) }
let(:instructeur) { create(:instructeur) }
before { create(:assign_to, gestionnaire: gestionnaire, procedure: procedure) }
before { create(:assign_to, instructeur: instructeur, procedure: procedure) }
it do
subject
expect(GestionnaireMailer).not_to have_received(:send_notifications)
expect(InstructeurMailer).not_to have_received(:send_notifications)
end
end
context 'when a gestionnaire enables its email_notification on one procedure' do
let(:gestionnaire_with_email_notifications) { create(:gestionnaire) }
context 'when a instructeur enables its email_notification on one procedure' do
let(:instructeur_with_email_notifications) { create(:instructeur) }
before do
create(:assign_to,
gestionnaire: gestionnaire_with_email_notifications,
instructeur: instructeur_with_email_notifications,
procedure: procedure,
email_notifications_enabled: true)
end
context "when there is no activity on the gestionnaire's procedures" do
context "when there is no activity on the instructeur's procedures" do
it do
subject
expect(GestionnaireMailer).not_to have_received(:send_notifications)
expect(InstructeurMailer).not_to have_received(:send_notifications)
end
end
@ -43,19 +43,19 @@ describe NotificationService do
it do
subject
expect(GestionnaireMailer).to have_received(:send_notifications)
expect(InstructeurMailer).to have_received(:send_notifications)
end
end
context 'when there is a notification on this procedure' do
before do
allow_any_instance_of(Gestionnaire).to receive(:notifications_for_procedure)
allow_any_instance_of(Instructeur).to receive(:notifications_for_procedure)
.and_return([12])
end
it do
subject
expect(GestionnaireMailer).to have_received(:send_notifications)
expect(InstructeurMailer).to have_received(:send_notifications)
end
end
end