- <%= link_to 'Réinviter', reinvite_manager_gestionnaire_path(gestionnaire), method: :post, class: 'button' %>
+ <%= link_to 'Réinviter', reinvite_manager_instructeur_path(instructeur), method: :post, class: 'button' %>
diff --git a/app/views/root/patron.html.haml b/app/views/root/patron.html.haml
index dcb3462bd..1e297d8cc 100644
--- a/app/views/root/patron.html.haml
+++ b/app/views/root/patron.html.haml
@@ -269,7 +269,7 @@
.answer.flex.align-start
.icon.bubble.avis-icon
.width-100
- %h2.gestionnaire
+ %h2.instructeur
= CONTACT_EMAIL
%span.date Réponse donnée le 13/01/2012
%p Je donne un avis favorable
diff --git a/app/views/shared/champs/dossier_link/_show.html.haml b/app/views/shared/champs/dossier_link/_show.html.haml
index acf5ac31b..442a6c71c 100644
--- a/app/views/shared/champs/dossier_link/_show.html.haml
+++ b/app/views/shared/champs/dossier_link/_show.html.haml
@@ -1,6 +1,6 @@
- dossier = Dossier.includes(:procedure).find_by(id: champ.to_s)
- if dossier
- - path = dossier_linked_path(current_gestionnaire || current_user, dossier)
+ - path = dossier_linked_path(current_instructeur || current_user, dossier)
- if path.present?
= link_to("Dossier nº #{dossier.id}", path, target: '_blank', rel: 'noopener')
- else
diff --git a/app/views/users/sessions/new.html.haml b/app/views/users/sessions/new.html.haml
index 894952a92..eb88d230a 100644
--- a/app/views/users/sessions/new.html.haml
+++ b/app/views/users/sessions/new.html.haml
@@ -24,7 +24,7 @@
= f.check_box :remember_me, as: :boolean
= f.label :remember_me, "Se souvenir de moi", class: 'remember-me'
- - if [:user, :gestionnaire].include?(resource_name)
+ - if [:user, :instructeur].include?(resource_name)
.text-right
= link_to "Mot de passe oublié ?", new_password_path(resource_name), class: "link"
diff --git a/config/initializers/passwords.rb b/config/initializers/passwords.rb
index ac712a985..65a5c37ab 100644
--- a/config/initializers/passwords.rb
+++ b/config/initializers/passwords.rb
@@ -1,4 +1,4 @@
-# complexity of the required password for the three kinds of users (user, gestionnaire, admnistrateur)
+# complexity of the required password for the three kinds of users (user, instructeur, admnistrateur)
# valid values are from 0 to 4, 0 means very simple, 4 means high level of complexity.
if !defined?(PASSWORD_MIN_LENGTH)
# PASSWORD_COMPLEXITY_FOR_USER = ENV.fetch('PASSWORD_COMPLEXITY_FOR_USER', '2').to_i
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index a1ab1f0e3..f48b60ed6 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -122,7 +122,7 @@ fr:
user:
siret: 'Numéro SIRET'
password: 'Le mot de passe'
- gestionnaire:
+ instructeur:
password: 'Le mot de passe'
errors:
messages:
@@ -153,7 +153,7 @@ fr:
attributes:
email:
taken: ': Invitation déjà envoyée'
- gestionnaire:
+ instructeur:
attributes:
email:
invalid: invalide
diff --git a/config/locales/models/instructeur/fr.yml b/config/locales/models/instructeur/fr.yml
index 741d2b9b0..297eb917f 100644
--- a/config/locales/models/instructeur/fr.yml
+++ b/config/locales/models/instructeur/fr.yml
@@ -1,6 +1,6 @@
fr:
activerecord:
models:
- gestionnaire:
+ instructeur:
one: Instructeur
other: Instructeurs
diff --git a/config/routes.rb b/config/routes.rb
index 9f43efe18..4f983e48c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -29,7 +29,7 @@ Rails.application.routes.draw do
post 'resend_confirmation_instructions', on: :member
end
- resources :gestionnaires, only: [:index, :show] do
+ resources :instructeurs, only: [:index, :show] do
post 'reinvite', on: :member
put 'enable_feature', on: :member
end
@@ -82,9 +82,9 @@ Rails.application.routes.draw do
passwords: 'administrateurs/passwords'
}, skip: [:registrations]
- devise_for :gestionnaires, controllers: {
- sessions: 'gestionnaires/sessions',
- passwords: 'gestionnaires/passwords'
+ devise_for :instructeurs, controllers: {
+ sessions: 'instructeurs/sessions',
+ passwords: 'instructeurs/passwords'
}, skip: [:registrations]
devise_for :users, controllers: {
@@ -101,10 +101,10 @@ Rails.application.routes.draw do
get 'lien-envoye/:email' => 'users/sessions#link_sent', constraints: { email: /.*/ }, as: 'link_sent'
end
- devise_scope :gestionnaire do
- get '/gestionnaires/sign_in/demo' => redirect("/users/sign_in")
- get '/gestionnaires/edit' => 'gestionnaires/registrations#edit', :as => 'edit_gestionnaires_registration'
- put '/gestionnaires' => 'gestionnaires/registrations#update', :as => 'gestionnaires_registration'
+ devise_scope :instructeur do
+ get '/instructeurs/sign_in/demo' => redirect("/users/sign_in")
+ get '/instructeurs/edit' => 'instructeurs/registrations#edit', :as => 'edit_instructeurs_registration'
+ put '/instructeurs' => 'instructeurs/registrations#update', :as => 'instructeurs_registration'
end
devise_scope :administrateur do
@@ -170,9 +170,9 @@ Rails.application.routes.draw do
get 'dossiers/invites/:id', to: redirect(path: '/invites/%{id}')
end
- namespace :gestionnaire do
- get 'activate' => '/gestionnaires/activate#new'
- patch 'activate' => '/gestionnaires/activate#create'
+ namespace :instructeur do
+ get 'activate' => '/instructeurs/activate#new'
+ patch 'activate' => '/instructeurs/activate#create'
end
namespace :admin do
@@ -222,7 +222,7 @@ Rails.application.routes.draw do
get 'show' # delete after fixed tests admin/instructeurs/show_spec without this line
end
- resources :gestionnaires, only: [:index, :create, :destroy]
+ resources :instructeurs, only: [:index, :create, :destroy]
end
#
@@ -300,7 +300,7 @@ Rails.application.routes.draw do
# Gestionnaire
#
- scope module: 'gestionnaires', as: 'gestionnaire' do
+ scope module: 'instructeurs', as: 'instructeur' do
resources :procedures, only: [:index, :show], param: :procedure_id do
member do
patch 'update_displayed_fields'
@@ -345,7 +345,7 @@ Rails.application.routes.draw do
post 'avis' => 'avis#create_avis'
get 'sign_up/email/:email' => 'avis#sign_up', constraints: { email: /.*/ }, as: 'sign_up'
- post 'sign_up/email/:email' => 'avis#create_gestionnaire', constraints: { email: /.*/ }
+ post 'sign_up/email/:email' => 'avis#create_instructeur', constraints: { email: /.*/ }
end
end
get "recherche" => "recherche#index"
diff --git a/spec/controllers/admin/assigns_controller_spec.rb b/spec/controllers/admin/assigns_controller_spec.rb
index 9dc03a1b3..5b433976d 100644
--- a/spec/controllers/admin/assigns_controller_spec.rb
+++ b/spec/controllers/admin/assigns_controller_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe Admin::AssignsController, type: :controller do
let(:admin) { create(:administrateur) }
let(:procedure) { create :procedure, administrateur: admin }
- let(:gestionnaire) { create :gestionnaire, administrateurs: [admin] }
+ let(:instructeur) { create :instructeur, administrateurs: [admin] }
before do
sign_in admin
@@ -15,7 +15,7 @@ describe Admin::AssignsController, type: :controller do
end
describe 'PUT #update' do
- subject { put :update, params: { instructeur_id: gestionnaire.id, procedure_id: procedure.id, to: 'assign' } }
+ subject { put :update, params: { instructeur_id: instructeur.id, procedure_id: procedure.id, to: 'assign' } }
it { expect(subject).to redirect_to admin_procedure_assigns_path(procedure_id: procedure.id) }
diff --git a/spec/controllers/admin/instructeurs_controller_spec.rb b/spec/controllers/admin/instructeurs_controller_spec.rb
index d8e03199e..ce908967e 100644
--- a/spec/controllers/admin/instructeurs_controller_spec.rb
+++ b/spec/controllers/admin/instructeurs_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe Admin::GestionnairesController, type: :controller do
+describe Admin::InstructeursController, type: :controller do
let(:admin) { create(:administrateur) }
let(:email_2) { 'plip@octo.com' }
let(:admin_2) { create :administrateur, email: email_2 }
@@ -17,9 +17,9 @@ describe Admin::GestionnairesController, type: :controller do
describe 'GET #index with sorting and pagination' do
subject {
get :index, params: {
- 'gestionnaires_smart_listing[page]': 1,
- 'gestionnaires_smart_listing[per_page]': 10,
- 'gestionnaires_smart_listing[sort][email]': 'asc'
+ 'instructeurs_smart_listing[page]': 1,
+ 'instructeurs_smart_listing[per_page]': 10,
+ 'instructeurs_smart_listing[sort][email]': 'asc'
}
}
@@ -29,17 +29,17 @@ describe Admin::GestionnairesController, type: :controller do
describe 'POST #create' do
let(:email) { 'test@plop.com' }
let(:procedure_id) { nil }
- subject { post :create, params: { gestionnaire: { email: email }, procedure_id: procedure_id } }
+ subject { post :create, params: { instructeur: { email: email }, procedure_id: procedure_id } }
context 'When email is valid' do
before do
subject
end
- let(:gestionnaire) { Gestionnaire.last }
+ let(:instructeur) { Instructeur.last }
it { expect(response.status).to eq(302) }
- it { expect(response).to redirect_to admin_gestionnaires_path }
+ it { expect(response).to redirect_to admin_instructeurs_path }
context 'when procedure_id params is not null' do
let(:procedure) { create :procedure }
@@ -49,13 +49,13 @@ describe Admin::GestionnairesController, type: :controller do
it { expect(response).to redirect_to admin_procedure_assigns_path(procedure_id: procedure_id) }
end
- describe 'Gestionnaire attributs in database' do
- it { expect(gestionnaire.email).to eq(email) }
+ describe 'Instructeur attributs in database' do
+ it { expect(instructeur.email).to eq(email) }
end
- describe 'New gestionnaire is assign to the admin' do
- it { expect(gestionnaire.administrateurs).to include admin }
- it { expect(admin.gestionnaires).to include gestionnaire }
+ describe 'New instructeur is assign to the admin' do
+ it { expect(instructeur.administrateurs).to include admin }
+ it { expect(admin.instructeurs).to include instructeur }
end
end
@@ -65,13 +65,13 @@ describe Admin::GestionnairesController, type: :controller do
end
let(:email) { 'piou' }
it { expect(response.status).to eq(302) }
- it { expect { response }.not_to change(Gestionnaire, :count) }
+ it { expect { response }.not_to change(Instructeur, :count) }
it { expect(flash[:alert]).to be_present }
describe 'Email Notification' do
it {
- expect(GestionnaireMailer).not_to receive(:new_gestionnaire)
- expect(GestionnaireMailer).not_to receive(:deliver_later)
+ expect(InstructeurMailer).not_to receive(:new_instructeur)
+ expect(InstructeurMailer).not_to receive(:deliver_later)
subject
}
end
@@ -83,28 +83,28 @@ describe Admin::GestionnairesController, type: :controller do
end
let(:email) { '' }
it { expect(response.status).to eq(302) }
- it { expect { response }.not_to change(Gestionnaire, :count) }
+ it { expect { response }.not_to change(Instructeur, :count) }
it 'Notification email is not send' do
- expect(GestionnaireMailer).not_to receive(:new_gestionnaire)
- expect(GestionnaireMailer).not_to receive(:deliver_later)
+ expect(InstructeurMailer).not_to receive(:new_instructeur)
+ expect(InstructeurMailer).not_to receive(:deliver_later)
end
end
context 'when email is already assign at the admin' do
before do
- create :gestionnaire, email: email, administrateurs: [admin]
+ create :instructeur, email: email, administrateurs: [admin]
subject
end
it { expect(response.status).to eq(302) }
- it { expect { response }.not_to change(Gestionnaire, :count) }
+ it { expect { response }.not_to change(Instructeur, :count) }
it { expect(flash[:alert]).to be_present }
describe 'Email notification' do
it 'is not sent when email already exists' do
- expect(GestionnaireMailer).not_to receive(:new_gestionnaire)
- expect(GestionnaireMailer).not_to receive(:deliver_later)
+ expect(InstructeurMailer).not_to receive(:new_instructeur)
+ expect(InstructeurMailer).not_to receive(:deliver_later)
subject
end
@@ -112,10 +112,10 @@ describe Admin::GestionnairesController, type: :controller do
end
context 'when an other admin will add the same email' do
- let(:gestionnaire) { Gestionnaire.find_by(email: email) }
+ let(:instructeur) { Instructeur.find_by(email: email) }
before do
- create :gestionnaire, email: email, administrateurs: [admin]
+ create :instructeur, email: email, administrateurs: [admin]
sign_out admin
sign_in admin_2
@@ -124,19 +124,19 @@ describe Admin::GestionnairesController, type: :controller do
end
it { expect(response.status).to eq(302) }
- it { expect { response }.not_to change(Gestionnaire, :count) }
+ it { expect { response }.not_to change(Instructeur, :count) }
it { expect(flash[:notice]).to be_present }
- it { expect(admin_2.gestionnaires).to include gestionnaire }
- it { expect(gestionnaire.administrateurs.size).to eq 2 }
+ it { expect(admin_2.instructeurs).to include instructeur }
+ it { expect(instructeur.administrateurs.size).to eq 2 }
end
context 'when an other admin will add the same email with some uppercase in it' do
let(:email) { 'Test@Plop.com' }
- let(:gestionnaire) { Gestionnaire.find_by(email: email.downcase) }
+ let(:instructeur) { Instructeur.find_by(email: email.downcase) }
before do
- create :gestionnaire, email: email, administrateurs: [admin]
+ create :instructeur, email: email, administrateurs: [admin]
sign_out admin
sign_in admin_2
@@ -144,12 +144,12 @@ describe Admin::GestionnairesController, type: :controller do
subject
end
- it { expect(admin_2.gestionnaires).to include gestionnaire }
+ it { expect(admin_2.instructeurs).to include instructeur }
end
context 'Email notification' do
it 'Notification email is sent when instructeur is create' do
- expect_any_instance_of(Gestionnaire).to receive(:invite!)
+ expect_any_instance_of(Instructeur).to receive(:invite!)
subject
end
end
@@ -160,9 +160,9 @@ describe Admin::GestionnairesController, type: :controller do
end
it "creates associated user with same credentials" do
- gestionnaire = controller.instance_variable_get(:@gestionnaire)
- user = User.find_by(email: gestionnaire.email)
- expect(user.valid_password?(gestionnaire.password)).to be(true)
+ instructeur = controller.instance_variable_get(:@instructeur)
+ user = User.find_by(email: instructeur.email)
+ expect(user.valid_password?(instructeur.password)).to be(true)
end
context 'invalid email' do
@@ -178,23 +178,23 @@ describe Admin::GestionnairesController, type: :controller do
describe 'DELETE #destroy' do
let(:email) { 'test@plop.com' }
let!(:admin) { create :administrateur }
- let!(:gestionnaire) { create :gestionnaire, email: email, administrateurs: [admin] }
+ let!(:instructeur) { create :instructeur, email: email, administrateurs: [admin] }
- subject { delete :destroy, params: { id: gestionnaire.id } }
+ subject { delete :destroy, params: { id: instructeur.id } }
context "when gestionaire_id is valid" do
before do
subject
admin.reload
- gestionnaire.reload
+ instructeur.reload
end
it { expect(response.status).to eq(302) }
- it { expect(response).to redirect_to admin_gestionnaires_path }
- it { expect(admin.gestionnaires).not_to include gestionnaire }
- it { expect(gestionnaire.administrateurs).not_to include admin }
+ it { expect(response).to redirect_to admin_instructeurs_path }
+ it { expect(admin.instructeurs).not_to include instructeur }
+ it { expect(instructeur.administrateurs).not_to include admin }
end
- it { expect { subject }.not_to change(Gestionnaire, :count) }
+ it { expect { subject }.not_to change(Instructeur, :count) }
end
end
diff --git a/spec/controllers/admin/procedures_controller_spec.rb b/spec/controllers/admin/procedures_controller_spec.rb
index 1569587b1..dbe4c104e 100644
--- a/spec/controllers/admin/procedures_controller_spec.rb
+++ b/spec/controllers/admin/procedures_controller_spec.rb
@@ -210,15 +210,15 @@ describe Admin::ProceduresController, type: :controller do
end
context 'when procedure is correctly saved' do
- let(:gestionnaire) { admin.gestionnaire }
+ let(:instructeur) { admin.instructeur }
before do
post :create, params: { procedure: procedure_params }
end
- describe "admin can also instruct the procedure as a gestionnaire" do
+ describe "admin can also instruct the procedure as a instructeur" do
subject { Procedure.last }
- it { expect(subject.gestionnaires).to include(gestionnaire) }
+ it { expect(subject.instructeurs).to include(instructeur) }
end
end
end
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index d8070743d..49a1fdea7 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -15,14 +15,14 @@ describe ApplicationController, type: :controller do
describe 'set_raven_context and append_info_to_payload' do
let(:current_user) { nil }
- let(:current_gestionnaire) { nil }
+ let(:current_instructeur) { nil }
let(:current_administrateur) { nil }
let(:current_administration) { nil }
let(:payload) { {} }
before do
expect(@controller).to receive(:current_user).and_return(current_user)
- expect(@controller).to receive(:current_gestionnaire).and_return(current_gestionnaire)
+ expect(@controller).to receive(:current_instructeur).and_return(current_instructeur)
expect(@controller).to receive(:current_administrateur).and_return(current_administrateur)
expect(@controller).to receive(:current_administration).and_return(current_administration)
allow(Raven).to receive(:user_context)
@@ -69,9 +69,9 @@ describe ApplicationController, type: :controller do
end
end
- context 'when someone is logged as a user, gestionnaire, administrateur and administration' do
+ context 'when someone is logged as a user, instructeur, administrateur and administration' do
let(:current_user) { create(:user) }
- let(:current_gestionnaire) { create(:gestionnaire) }
+ let(:current_instructeur) { create(:instructeur) }
let(:current_administrateur) { create(:administrateur) }
let(:current_administration) { create(:administration) }
@@ -88,7 +88,7 @@ describe ApplicationController, type: :controller do
user_agent: 'Rails Testing',
user_id: current_user.id,
user_email: current_user.email,
- user_roles: 'User, Gestionnaire, Administrateur, Administration'
+ user_roles: 'User, Instructeur, Administrateur, Administration'
})
end
end
@@ -108,7 +108,7 @@ describe ApplicationController, type: :controller do
before { @controller.send(:reject) }
it { expect(@controller).to have_received(:sign_out).with(:user) }
- it { expect(@controller).to have_received(:sign_out).with(:gestionnaire) }
+ it { expect(@controller).to have_received(:sign_out).with(:instructeur) }
it { expect(@controller).to have_received(:sign_out).with(:administrateur) }
it { expect(flash[:alert]).to eq(ApplicationController::MAINTENANCE_MESSAGE) }
it { expect(@controller).to have_received(:redirect_to).with(root_path) }
@@ -148,13 +148,13 @@ describe ApplicationController, type: :controller do
end
describe '#redirect_if_unstrusted' do
- let(:current_gestionnaire) { create(:gestionnaire) }
+ let(:current_instructeur) { create(:instructeur) }
before do
- allow(@controller).to receive(:current_gestionnaire).and_return(current_gestionnaire)
+ allow(@controller).to receive(:current_instructeur).and_return(current_instructeur)
allow(@controller).to receive(:redirect_to)
allow(@controller).to receive(:trusted_device?).and_return(trusted_device)
- allow(@controller).to receive(:gestionnaire_signed_in?).and_return(gestionnaire_signed_in)
+ allow(@controller).to receive(:instructeur_signed_in?).and_return(instructeur_signed_in)
allow(@controller).to receive(:sensitive_path).and_return(sensitive_path)
allow(@controller).to receive(:send_login_token_or_bufferize)
allow(@controller).to receive(:store_location_for)
@@ -166,8 +166,8 @@ describe ApplicationController, type: :controller do
context 'when the path is sensitive' do
let(:sensitive_path) { true }
- context 'when the gestionnaire is signed_in' do
- let(:gestionnaire_signed_in) { true }
+ context 'when the instructeur is signed_in' do
+ let(:instructeur_signed_in) { true }
context 'when the feature is activated' do
before do
diff --git a/spec/controllers/instructeurs/activate_controller_spec.rb b/spec/controllers/instructeurs/activate_controller_spec.rb
index fa7ce7857..3c973580c 100644
--- a/spec/controllers/instructeurs/activate_controller_spec.rb
+++ b/spec/controllers/instructeurs/activate_controller_spec.rb
@@ -1,7 +1,7 @@
-describe Gestionnaires::ActivateController, type: :controller do
+describe Instructeurs::ActivateController, type: :controller do
describe '#new' do
- let(:gestionnaire) { create(:gestionnaire) }
- let(:token) { gestionnaire.send(:set_reset_password_token) }
+ let(:instructeur) { create(:instructeur) }
+ let(:token) { instructeur.send(:set_reset_password_token) }
before { allow(controller).to receive(:trust_device) }
diff --git a/spec/controllers/instructeurs/avis_controller_spec.rb b/spec/controllers/instructeurs/avis_controller_spec.rb
index 0cec7bbe5..1c150f892 100644
--- a/spec/controllers/instructeurs/avis_controller_spec.rb
+++ b/spec/controllers/instructeurs/avis_controller_spec.rb
@@ -1,17 +1,17 @@
require 'spec_helper'
-describe Gestionnaires::AvisController, type: :controller do
- context 'with a gestionnaire signed in' do
+describe Instructeurs::AvisController, type: :controller do
+ context 'with a instructeur signed in' do
render_views
- let(:claimant) { create(:gestionnaire) }
- let(:gestionnaire) { create(:gestionnaire) }
- let(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
+ let(:claimant) { create(:instructeur) }
+ let(:instructeur) { create(:instructeur) }
+ let(:procedure) { create(:procedure, :published, instructeurs: [instructeur]) }
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
- let!(:avis_without_answer) { Avis.create(dossier: dossier, claimant: claimant, gestionnaire: gestionnaire) }
- let!(:avis_with_answer) { Avis.create(dossier: dossier, claimant: claimant, gestionnaire: gestionnaire, answer: 'yop') }
+ let!(:avis_without_answer) { Avis.create(dossier: dossier, claimant: claimant, instructeur: instructeur) }
+ let!(:avis_with_answer) { Avis.create(dossier: dossier, claimant: claimant, instructeur: instructeur, answer: 'yop') }
- before { sign_in(gestionnaire) }
+ before { sign_in(instructeur) }
describe '#index' do
before { get :index }
@@ -60,7 +60,7 @@ describe Gestionnaires::AvisController, type: :controller do
end
it 'should be ok' do
- expect(response).to redirect_to(instruction_gestionnaire_avis_path(avis_without_answer))
+ expect(response).to redirect_to(instruction_instructeur_avis_path(avis_without_answer))
expect(avis_without_answer.answer).to eq('answer')
expect(avis_without_answer.piece_justificative_file).to_not be_attached
expect(flash.notice).to eq('Votre réponse est enregistrée.')
@@ -80,7 +80,7 @@ describe Gestionnaires::AvisController, type: :controller do
end
it 'should be ok' do
- expect(response).to redirect_to(instruction_gestionnaire_avis_path(avis_without_answer))
+ expect(response).to redirect_to(instruction_instructeur_avis_path(avis_without_answer))
expect(avis_without_answer.answer).to eq('answer')
expect(avis_without_answer.piece_justificative_file).to be_attached
expect(flash.notice).to eq('Votre réponse est enregistrée.')
@@ -101,7 +101,7 @@ describe Gestionnaires::AvisController, type: :controller do
it do
subject
- expect(response).to redirect_to(messagerie_gestionnaire_avis_path(avis_without_answer))
+ expect(response).to redirect_to(messagerie_instructeur_avis_path(avis_without_answer))
expect(dossier.commentaires.map(&:body)).to match(['commentaire body'])
end
@@ -118,7 +118,7 @@ describe Gestionnaires::AvisController, type: :controller do
end
describe '#create_avis' do
- let!(:previous_avis) { Avis.create(dossier: dossier, claimant: claimant, gestionnaire: gestionnaire, confidentiel: previous_avis_confidentiel) }
+ let!(:previous_avis) { Avis.create(dossier: dossier, claimant: claimant, instructeur: instructeur, confidentiel: previous_avis_confidentiel) }
let(:emails) { ['a@b.com'] }
let(:intro) { 'introduction' }
let(:created_avis) { Avis.last }
@@ -160,8 +160,8 @@ describe Gestionnaires::AvisController, type: :controller do
it { expect(created_avis.email).to eq(emails.last) }
it { expect(created_avis.introduction).to eq(intro) }
it { expect(created_avis.dossier).to eq(previous_avis.dossier) }
- it { expect(created_avis.claimant).to eq(gestionnaire) }
- it { expect(response).to redirect_to(instruction_gestionnaire_avis_path(previous_avis)) }
+ it { expect(created_avis.claimant).to eq(instructeur) }
+ it { expect(response).to redirect_to(instruction_instructeur_avis_path(previous_avis)) }
end
context 'when the user asked for a confidentiel avis' do
@@ -183,14 +183,14 @@ describe Gestionnaires::AvisController, type: :controller do
end
end
- context 'without a gestionnaire signed in' do
+ context 'without a instructeur signed in' do
describe '#sign_up' do
let(:invited_email) { 'invited@avis.com' }
let(:dossier) { create(:dossier) }
let!(:avis) { create(:avis, email: invited_email, dossier: dossier) }
let(:invitations_email) { true }
- context 'when the new gestionnaire has never signed up' do
+ context 'when the new instructeur has never signed up' do
before do
expect(Avis).to receive(:avis_exists_and_email_belongs_to_avis?)
.with(avis.id.to_s, invited_email)
@@ -211,43 +211,43 @@ describe Gestionnaires::AvisController, type: :controller do
end
end
- context 'when the gestionnaire has already signed up and belongs to the invitation' do
- let(:gestionnaire) { create(:gestionnaire, email: invited_email) }
- let!(:avis) { create(:avis, dossier: dossier, gestionnaire: gestionnaire) }
+ context 'when the instructeur has already signed up and belongs to the invitation' do
+ let(:instructeur) { create(:instructeur, email: invited_email) }
+ let!(:avis) { create(:avis, dossier: dossier, instructeur: instructeur) }
- context 'when the gestionnaire is authenticated' do
+ context 'when the instructeur is authenticated' do
before do
- sign_in gestionnaire
+ sign_in instructeur
get :sign_up, params: { id: avis.id, email: invited_email }
end
- it { is_expected.to redirect_to gestionnaire_avis_url(avis) }
+ it { is_expected.to redirect_to instructeur_avis_url(avis) }
end
- context 'when the gestionnaire is not authenticated' do
+ context 'when the instructeur is not authenticated' do
before do
get :sign_up, params: { id: avis.id, email: invited_email }
end
- it { is_expected.to redirect_to new_gestionnaire_session_url }
+ it { is_expected.to redirect_to new_instructeur_session_url }
end
end
- context 'when the gestionnaire has already signed up / is authenticated and does not belong to the invitation' do
- let(:gestionnaire) { create(:gestionnaire, email: 'other@gmail.com') }
+ context 'when the instructeur has already signed up / is authenticated and does not belong to the invitation' do
+ let(:instructeur) { create(:instructeur, email: 'other@gmail.com') }
let!(:avis) { create(:avis, email: invited_email, dossier: dossier) }
before do
- sign_in gestionnaire
+ sign_in instructeur
get :sign_up, params: { id: avis.id, email: invited_email }
end
- # redirected to dossier but then the gestionnaire gonna be banished !
- it { is_expected.to redirect_to gestionnaire_avis_url(avis) }
+ # redirected to dossier but then the instructeur gonna be banished !
+ it { is_expected.to redirect_to instructeur_avis_url(avis) }
end
end
- describe '#create_gestionnaire' do
+ describe '#create_instructeur' do
let(:existing_user_mail) { 'dummy@example.org' }
let!(:existing_user) { create(:user, email: existing_user_mail) }
let(:invited_email) { 'invited@avis.com' }
@@ -255,19 +255,19 @@ describe Gestionnaires::AvisController, type: :controller do
let!(:avis) { create(:avis, email: invited_email, dossier: dossier) }
let(:avis_id) { avis.id }
let(:password) { 'démarches-simplifiées-pwd' }
- let(:created_gestionnaire) { Gestionnaire.find_by(email: invited_email) }
+ let(:created_instructeur) { Instructeur.find_by(email: invited_email) }
let(:invitations_email) { true }
before do
- allow(Avis).to receive(:link_avis_to_gestionnaire)
+ allow(Avis).to receive(:link_avis_to_instructeur)
expect(Avis).to receive(:avis_exists_and_email_belongs_to_avis?)
.with(avis_id.to_s, invited_email)
.and_return(invitations_email)
- post :create_gestionnaire, params: {
+ post :create_instructeur, params: {
id: avis_id,
email: invited_email,
- gestionnaire: {
+ instructeur: {
password: password
}
}
@@ -280,14 +280,14 @@ describe Gestionnaires::AvisController, type: :controller do
end
context 'when the email belongs to the invitation' do
- context 'when the gestionnaire creation succeeds' do
- it { expect(created_gestionnaire).to be_present }
- it { expect(created_gestionnaire.valid_password?(password)).to be true }
+ context 'when the instructeur creation succeeds' do
+ it { expect(created_instructeur).to be_present }
+ it { expect(created_instructeur.valid_password?(password)).to be true }
- it { expect(Avis).to have_received(:link_avis_to_gestionnaire) }
+ it { expect(Avis).to have_received(:link_avis_to_instructeur) }
- it { expect(subject.current_gestionnaire).to eq(created_gestionnaire) }
- it { is_expected.to redirect_to gestionnaire_avis_index_path }
+ it { expect(subject.current_instructeur).to eq(created_instructeur) }
+ it { is_expected.to redirect_to instructeur_avis_index_path }
it 'creates a corresponding user account for the email' do
user = User.find_by(email: invited_email)
@@ -297,17 +297,17 @@ describe Gestionnaires::AvisController, type: :controller do
context 'when there already is a user account with the same email' do
let(:existing_user_mail) { invited_email }
- it 'still creates a gestionnaire account' do
- expect(created_gestionnaire).to be_present
+ it 'still creates a instructeur account' do
+ expect(created_instructeur).to be_present
end
end
end
- context 'when the gestionnaire creation fails' do
+ context 'when the instructeur creation fails' do
let(:password) { '' }
- it { expect(created_gestionnaire).to be_nil }
- it { is_expected.to redirect_to sign_up_gestionnaire_avis_path(avis_id, invited_email) }
+ it { expect(created_instructeur).to be_nil }
+ it { is_expected.to redirect_to sign_up_instructeur_avis_path(avis_id, invited_email) }
it { expect(flash.alert).to eq(['Le mot de passe doit être rempli']) }
end
end
diff --git a/spec/controllers/instructeurs/dossiers_controller_spec.rb b/spec/controllers/instructeurs/dossiers_controller_spec.rb
index 986ae1e46..53f24119d 100644
--- a/spec/controllers/instructeurs/dossiers_controller_spec.rb
+++ b/spec/controllers/instructeurs/dossiers_controller_spec.rb
@@ -1,23 +1,23 @@
require 'spec_helper'
-describe Gestionnaires::DossiersController, type: :controller do
+describe Instructeurs::DossiersController, type: :controller do
render_views
- let(:gestionnaire) { create(:gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
let(:administrateur) { create(:administrateur) }
let(:administration) { create(:administration) }
- let(:gestionnaires) { [gestionnaire] }
- let(:procedure) { create(:procedure, :published, gestionnaires: gestionnaires) }
+ let(:instructeurs) { [instructeur] }
+ let(:procedure) { create(:procedure, :published, instructeurs: instructeurs) }
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
let(:fake_justificatif) { Rack::Test::UploadedFile.new("./spec/fixtures/files/piece_justificative_0.pdf", 'application/pdf') }
- before { sign_in(gestionnaire) }
+ before { sign_in(instructeur) }
describe '#attestation' do
context 'when a dossier has an attestation' do
let(:fake_pdf) { double(read: 'pdf content') }
let!(:dossier) { create(:dossier, :en_construction, attestation: Attestation.new, procedure: procedure) }
- let!(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
+ let!(:procedure) { create(:procedure, :published, instructeurs: [instructeur]) }
let!(:dossier) { create(:dossier, :en_construction, attestation: Attestation.new, procedure: procedure) }
it 'returns the attestation pdf' do
@@ -35,16 +35,16 @@ describe Gestionnaires::DossiersController, type: :controller do
end
describe '#send_to_instructeurs' do
- let(:recipient) { create(:gestionnaire) }
- let(:gestionnaires) { [gestionnaire, recipient] }
+ let(:recipient) { create(:instructeur) }
+ let(:instructeurs) { [instructeur, recipient] }
let(:mail) { double("mail") }
before do
expect(mail).to receive(:deliver_later)
- expect(GestionnaireMailer)
+ expect(InstructeurMailer)
.to receive(:send_dossier)
- .with(gestionnaire, dossier, recipient)
+ .with(instructeur, dossier, recipient)
.and_return(mail)
post(
@@ -57,7 +57,7 @@ describe Gestionnaires::DossiersController, type: :controller do
)
end
- it { expect(response).to redirect_to(personnes_impliquees_gestionnaire_dossier_url) }
+ it { expect(response).to redirect_to(personnes_impliquees_instructeur_dossier_url) }
end
describe '#follow' do
@@ -65,34 +65,34 @@ describe Gestionnaires::DossiersController, type: :controller do
patch :follow, params: { procedure_id: procedure.id, dossier_id: dossier.id }
end
- it { expect(gestionnaire.followed_dossiers).to match([dossier]) }
+ it { expect(instructeur.followed_dossiers).to match([dossier]) }
it { expect(flash.notice).to eq('Dossier suivi') }
- it { expect(response).to redirect_to(gestionnaire_procedures_url) }
+ it { expect(response).to redirect_to(instructeur_procedures_url) }
end
describe '#unfollow' do
before do
- gestionnaire.followed_dossiers << dossier
+ instructeur.followed_dossiers << dossier
patch :unfollow, params: { procedure_id: procedure.id, dossier_id: dossier.id }
- gestionnaire.reload
+ instructeur.reload
end
- it { expect(gestionnaire.followed_dossiers).to match([]) }
+ it { expect(instructeur.followed_dossiers).to match([]) }
it { expect(flash.notice).to eq("Vous ne suivez plus le dossier nº #{dossier.id}") }
- it { expect(response).to redirect_to(gestionnaire_procedures_url) }
+ it { expect(response).to redirect_to(instructeur_procedures_url) }
end
describe '#archive' do
before do
- gestionnaire.follow(dossier)
+ instructeur.follow(dossier)
patch :archive, params: { procedure_id: procedure.id, dossier_id: dossier.id }
dossier.reload
- gestionnaire.reload
+ instructeur.reload
end
it { expect(dossier.archived).to be true }
- it { expect(response).to redirect_to(gestionnaire_procedures_url) }
- it { expect(gestionnaire.followed_dossiers).not_to include(dossier) }
+ it { expect(response).to redirect_to(instructeur_procedures_url) }
+ it { expect(instructeur.followed_dossiers).not_to include(dossier) }
end
describe '#unarchive' do
@@ -103,19 +103,19 @@ describe Gestionnaires::DossiersController, type: :controller do
end
it { expect(dossier.archived).to be false }
- it { expect(response).to redirect_to(gestionnaire_procedures_url) }
+ it { expect(response).to redirect_to(instructeur_procedures_url) }
end
describe '#passer_en_instruction' do
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
before do
- sign_in gestionnaire
+ sign_in instructeur
post :passer_en_instruction, params: { procedure_id: procedure.id, dossier_id: dossier.id }, format: 'js'
end
it { expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_instruction)) }
- it { expect(gestionnaire.follow?(dossier)).to be true }
+ it { expect(instructeur.follow?(dossier)).to be true }
it { expect(response).to have_http_status(:ok) }
it { expect(response.body).to include('.state-button') }
@@ -133,7 +133,7 @@ describe Gestionnaires::DossiersController, type: :controller do
let(:dossier) { create(:dossier, :en_instruction, procedure: procedure) }
before do
- sign_in gestionnaire
+ sign_in instructeur
post :repasser_en_construction,
params: { procedure_id: procedure.id, dossier_id: dossier.id },
format: 'js'
@@ -155,7 +155,7 @@ describe Gestionnaires::DossiersController, type: :controller do
describe '#repasser_en_instruction' do
let(:dossier) { create(:dossier, :refuse, procedure: procedure) }
- let(:current_user) { gestionnaire }
+ let(:current_user) { instructeur }
before do
sign_in current_user
@@ -180,7 +180,7 @@ describe Gestionnaires::DossiersController, type: :controller do
context 'when the dossier is accepte' do
let(:dossier) { create(:dossier, :accepte, procedure: procedure) }
- it 'it is not possible to go back to en_instruction as gestionnaire' do
+ it 'it is not possible to go back to en_instruction as instructeur' do
expect(dossier.reload.state).to eq(Dossier.states.fetch(:accepte))
expect(response).to have_http_status(:ok)
end
@@ -205,7 +205,7 @@ describe Gestionnaires::DossiersController, type: :controller do
context "with refuser" do
before do
dossier.en_instruction!
- sign_in gestionnaire
+ sign_in instructeur
end
context 'simple refusal' do
@@ -246,7 +246,7 @@ describe Gestionnaires::DossiersController, type: :controller do
context "with classer_sans_suite" do
before do
dossier.en_instruction!
- sign_in gestionnaire
+ sign_in instructeur
end
context 'without attachment' do
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier.id }, format: 'js' }
@@ -288,7 +288,7 @@ describe Gestionnaires::DossiersController, type: :controller do
context "with accepter" do
before do
dossier.en_instruction!
- sign_in gestionnaire
+ sign_in instructeur
expect(NotificationMailer).to receive(:send_closed_notification)
.with(dossier)
@@ -321,7 +321,7 @@ describe Gestionnaires::DossiersController, type: :controller do
allow_any_instance_of(Dossier).to receive(:build_attestation).and_return(attestation)
end
- it 'The gestionnaire is sent back to the dossier page' do
+ it 'The instructeur is sent back to the dossier page' do
expect(subject.body).to include('.state-button')
end
@@ -337,7 +337,7 @@ describe Gestionnaires::DossiersController, type: :controller do
context 'when the attestation template uses the motivation field' do
let(:emailable) { false }
let(:template) { create(:attestation_template) }
- let(:procedure) { create(:procedure, :published, attestation_template: template, gestionnaires: [gestionnaire]) }
+ let(:procedure) { create(:procedure, :published, attestation_template: template, instructeurs: [instructeur]) }
subject do
post :terminer, params: {
@@ -415,9 +415,9 @@ describe Gestionnaires::DossiersController, type: :controller do
it "creates a commentaire" do
expect { subject }.to change(Commentaire, :count).by(1)
- expect(gestionnaire.followed_dossiers).to include(dossier)
+ expect(instructeur.followed_dossiers).to include(dossier)
- expect(response).to redirect_to(messagerie_gestionnaire_dossier_path(dossier.procedure, dossier))
+ expect(response).to redirect_to(messagerie_instructeur_dossier_path(dossier.procedure, dossier))
expect(flash.notice).to be_present
end
@@ -426,9 +426,9 @@ describe Gestionnaires::DossiersController, type: :controller do
it "creates a commentaire (shows message that file have a virus)" do
expect { subject }.to change(Commentaire, :count).by(1)
- expect(gestionnaire.followed_dossiers).to include(dossier)
+ expect(instructeur.followed_dossiers).to include(dossier)
- expect(response).to redirect_to(messagerie_gestionnaire_dossier_path(dossier.procedure, dossier))
+ expect(response).to redirect_to(messagerie_instructeur_dossier_path(dossier.procedure, dossier))
expect(flash.notice).to be_present
end
end
@@ -456,8 +456,8 @@ describe Gestionnaires::DossiersController, type: :controller do
it { expect(saved_avis.introduction).to eq('intro') }
it { expect(saved_avis.confidentiel).to eq(true) }
it { expect(saved_avis.dossier).to eq(dossier) }
- it { expect(saved_avis.claimant).to eq(gestionnaire) }
- it { expect(response).to redirect_to(avis_gestionnaire_dossier_path(dossier.procedure, dossier)) }
+ it { expect(saved_avis.claimant).to eq(instructeur) }
+ it { expect(response).to redirect_to(avis_instructeur_dossier_path(dossier.procedure, dossier)) }
context "with an invalid email" do
let(:emails) { ['emaila.com'] }
@@ -548,7 +548,7 @@ describe Gestionnaires::DossiersController, type: :controller do
it { expect(champ_linked_drop_down_list.secondary_value).to eq('secondary') }
it { expect(champ_datetime.value).to eq('21/12/2019 13:17') }
it { expect(champ_repetition.champs.first.value).to eq('text') }
- it { expect(response).to redirect_to(annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier)) }
+ it { expect(response).to redirect_to(annotations_privees_instructeur_dossier_path(dossier.procedure, dossier)) }
end
describe "#telecharger_pjs" do
diff --git a/spec/controllers/instructeurs/instructeur_controller_spec.rb b/spec/controllers/instructeurs/instructeur_controller_spec.rb
index 63fd8c3bd..67ea8ca89 100644
--- a/spec/controllers/instructeurs/instructeur_controller_spec.rb
+++ b/spec/controllers/instructeurs/instructeur_controller_spec.rb
@@ -1,14 +1,14 @@
require 'spec_helper'
-describe Gestionnaires::GestionnaireController, type: :controller do
- describe 'before actions: authenticate_gestionnaire!' do
+describe Instructeurs::InstructeurController, type: :controller do
+ describe 'before actions: authenticate_instructeur!' do
it 'is present' do
- before_actions = Gestionnaires::GestionnaireController
+ before_actions = Instructeurs::InstructeurController
._process_action_callbacks
.find_all { |process_action_callbacks| process_action_callbacks.kind == :before }
.map(&:filter)
- expect(before_actions).to include(:authenticate_gestionnaire!)
+ expect(before_actions).to include(:authenticate_instructeur!)
end
end
end
diff --git a/spec/controllers/instructeurs/passwords_controller_spec.rb b/spec/controllers/instructeurs/passwords_controller_spec.rb
index 2064ee5d7..dffd33b36 100644
--- a/spec/controllers/instructeurs/passwords_controller_spec.rb
+++ b/spec/controllers/instructeurs/passwords_controller_spec.rb
@@ -1,37 +1,37 @@
require "spec_helper"
-describe Gestionnaires::PasswordsController, type: :controller do
+describe Instructeurs::PasswordsController, type: :controller do
before do
- @request.env["devise.mapping"] = Devise.mappings[:gestionnaire]
+ @request.env["devise.mapping"] = Devise.mappings[:instructeur]
end
describe "update" do
context "unified login" do
let(:user) { create(:user, email: 'unique@plop.com', password: 'démarches-simplifiées-pwd') }
let(:administrateur) { create(:administrateur, email: 'unique@plop.com', password: 'démarches-simplifiées-pwd') }
- let(:gestionnaire) { administrateur.gestionnaire }
+ let(:instructeur) { administrateur.instructeur }
before do
- @token = gestionnaire.send(:set_reset_password_token)
+ @token = instructeur.send(:set_reset_password_token)
user # make sure it's created
administrateur # make sure it's created
end
it "also signs user in" do
put :update, params: {
- gestionnaire: {
+ instructeur: {
reset_password_token: @token,
password: "démarches-simplifiées-pwd",
password_confirmation: "démarches-simplifiées-pwd"
}
}
- expect(subject.current_gestionnaire).to eq(gestionnaire)
+ expect(subject.current_instructeur).to eq(instructeur)
expect(subject.current_user).to eq(user)
end
it "also signs administrateur in" do
put :update, params: {
- gestionnaire: {
+ instructeur: {
reset_password_token: @token,
password: "démarches-simplifiées-pwd",
password_confirmation: "démarches-simplifiées-pwd"
diff --git a/spec/controllers/instructeurs/procedures_controller_spec.rb b/spec/controllers/instructeurs/procedures_controller_spec.rb
index e0951964f..066eea47f 100644
--- a/spec/controllers/instructeurs/procedures_controller_spec.rb
+++ b/spec/controllers/instructeurs/procedures_controller_spec.rb
@@ -1,9 +1,9 @@
require 'spec_helper'
-describe Gestionnaires::ProceduresController, type: :controller do
+describe Instructeurs::ProceduresController, type: :controller do
describe "before_action: ensure_ownership!" do
it "is present" do
- before_actions = Gestionnaires::ProceduresController
+ before_actions = Instructeurs::ProceduresController
._process_action_callbacks
.find_all { |process_action_callbacks| process_action_callbacks.kind == :before }
.map(&:filter)
@@ -13,18 +13,18 @@ describe Gestionnaires::ProceduresController, type: :controller do
end
describe "ensure_ownership!" do
- let(:gestionnaire) { create(:gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
before do
@controller.params = @controller.params.merge(procedure_id: asked_procedure.id)
- expect(@controller).to receive(:current_gestionnaire).and_return(gestionnaire)
+ expect(@controller).to receive(:current_instructeur).and_return(instructeur)
allow(@controller).to receive(:redirect_to)
@controller.send(:ensure_ownership!)
end
- context "when a gestionnaire asks for its procedure" do
- let(:asked_procedure) { create(:procedure, gestionnaires: [gestionnaire]) }
+ context "when a instructeur asks for its procedure" do
+ let(:asked_procedure) { create(:procedure, instructeurs: [instructeur]) }
it "does not redirects nor flash" do
expect(@controller).not_to have_received(:redirect_to)
@@ -32,7 +32,7 @@ describe Gestionnaires::ProceduresController, type: :controller do
end
end
- context "when a gestionnaire asks for another procedure" do
+ context "when a instructeur asks for another procedure" do
let(:asked_procedure) { create(:procedure) }
it "redirects and flash" do
@@ -44,7 +44,7 @@ describe Gestionnaires::ProceduresController, type: :controller do
describe "before_action: redirect_to_avis_if_needed" do
it "is present" do
- before_actions = Gestionnaires::ProceduresController
+ before_actions = Instructeurs::ProceduresController
._process_action_callbacks
.find_all { |process_action_callbacks| process_action_callbacks.kind == :before }
.map(&:filter)
@@ -54,15 +54,15 @@ describe Gestionnaires::ProceduresController, type: :controller do
end
describe "redirect_to_avis_if_needed" do
- let(:gestionnaire) { create(:gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
before do
- expect(@controller).to receive(:current_gestionnaire).at_least(:once).and_return(gestionnaire)
+ expect(@controller).to receive(:current_instructeur).at_least(:once).and_return(instructeur)
allow(@controller).to receive(:redirect_to)
end
- context "when a gestionnaire has some procedures" do
- let!(:some_procedure) { create(:procedure, gestionnaires: [gestionnaire]) }
+ context "when a instructeur has some procedures" do
+ let!(:some_procedure) { create(:procedure, instructeurs: [instructeur]) }
before { @controller.send(:redirect_to_avis_if_needed) }
@@ -71,20 +71,20 @@ describe Gestionnaires::ProceduresController, type: :controller do
end
end
- context "when a gestionnaire has no procedure and some avis" do
+ context "when a instructeur has no procedure and some avis" do
before do
- Avis.create!(dossier: create(:dossier), claimant: create(:gestionnaire), gestionnaire: gestionnaire)
+ Avis.create!(dossier: create(:dossier), claimant: create(:instructeur), instructeur: instructeur)
@controller.send(:redirect_to_avis_if_needed)
end
it "redirects avis" do
- expect(@controller).to have_received(:redirect_to).with(gestionnaire_avis_index_path)
+ expect(@controller).to have_received(:redirect_to).with(instructeur_avis_index_path)
end
end
end
describe "#index" do
- let(:gestionnaire) { create(:gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
subject { get :index }
context "when not logged" do
@@ -93,7 +93,7 @@ describe Gestionnaires::ProceduresController, type: :controller do
end
context "when logged in" do
- before { sign_in(gestionnaire) }
+ before { sign_in(instructeur) }
it { expect(response).to have_http_status(:ok) }
@@ -103,9 +103,9 @@ describe Gestionnaires::ProceduresController, type: :controller do
let(:procedure3) { create(:procedure) }
before do
- gestionnaire.procedures << procedure1
- gestionnaire.procedures << procedure2
- gestionnaire.procedures << procedure3
+ instructeur.procedures << procedure1
+ instructeur.procedures << procedure2
+ instructeur.procedures << procedure3
subject
end
@@ -117,7 +117,7 @@ describe Gestionnaires::ProceduresController, type: :controller do
let(:dossier) { create(:dossier, state: state, procedure: procedure) }
before do
- gestionnaire.procedures << procedure
+ instructeur.procedures << procedure
dossier
end
@@ -141,10 +141,10 @@ describe Gestionnaires::ProceduresController, type: :controller do
create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_instruction))
create(:dossier, procedure: procedure, state: Dossier.states.fetch(:sans_suite), archived: true)
- gestionnaire.procedures << procedure2
+ instructeur.procedures << procedure2
create(:dossier, :followed, procedure: procedure2, state: Dossier.states.fetch(:en_construction))
create(:dossier, procedure: procedure2, state: Dossier.states.fetch(:accepte))
- gestionnaire.followed_dossiers << create(:dossier, procedure: procedure2, state: Dossier.states.fetch(:en_instruction))
+ instructeur.followed_dossiers << create(:dossier, procedure: procedure2, state: Dossier.states.fetch(:en_instruction))
subject
end
@@ -166,12 +166,12 @@ describe Gestionnaires::ProceduresController, type: :controller do
end
describe "#show" do
- let(:gestionnaire) { create(:gestionnaire) }
- let!(:procedure) { create(:procedure, gestionnaires: [gestionnaire]) }
+ let(:instructeur) { create(:instructeur) }
+ let!(:procedure) { create(:procedure, instructeurs: [instructeur]) }
context "when logged in" do
before do
- sign_in(gestionnaire)
+ sign_in(instructeur)
end
context "without anything" do
@@ -213,7 +213,7 @@ describe Gestionnaires::ProceduresController, type: :controller do
let!(:new_followed_dossier) { create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_instruction)) }
before do
- gestionnaire.followed_dossiers << new_followed_dossier
+ instructeur.followed_dossiers << new_followed_dossier
get :show, params: { procedure_id: procedure.id }
end
@@ -259,7 +259,7 @@ describe Gestionnaires::ProceduresController, type: :controller do
let!(:archived_dossier) { Timecop.freeze(4.days.ago) { create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_instruction), archived: true) } }
before do
- gestionnaire.followed_dossiers << new_followed_dossier
+ instructeur.followed_dossiers << new_followed_dossier
get :show, params: { procedure_id: procedure.id, statut: statut }
end
@@ -309,12 +309,12 @@ describe Gestionnaires::ProceduresController, type: :controller do
end
describe "#download_dossiers" do
- let(:gestionnaire) { create(:gestionnaire) }
- let!(:procedure) { create(:procedure, gestionnaires: [gestionnaire]) }
+ let(:instructeur) { create(:instructeur) }
+ let!(:procedure) { create(:procedure, instructeurs: [instructeur]) }
context "when logged in" do
before do
- sign_in(gestionnaire)
+ sign_in(instructeur)
end
context "csv" do
@@ -338,22 +338,22 @@ describe Gestionnaires::ProceduresController, type: :controller do
end
describe '#update_email_notifications' do
- let(:gestionnaire) { create(:gestionnaire) }
- let!(:procedure) { create(:procedure, gestionnaires: [gestionnaire]) }
+ let(:instructeur) { create(:instructeur) }
+ let!(:procedure) { create(:procedure, instructeurs: [instructeur]) }
context "when logged in" do
- before { sign_in(gestionnaire) }
+ before { sign_in(instructeur) }
- it { expect(gestionnaire.procedures_with_email_notifications).to be_empty }
+ it { expect(instructeur.procedures_with_email_notifications).to be_empty }
- context 'when the gestionnaire update its preferences' do
- let(:assign_to) { gestionnaire.assign_to.find_by(procedure: procedure) }
+ context 'when the instructeur update its preferences' do
+ let(:assign_to) { instructeur.assign_to.find_by(procedure: procedure) }
before do
patch :update_email_notifications, params: { procedure_id: procedure.id, assign_to: { id: assign_to.id, email_notifications_enabled: true } }
end
- it { expect(gestionnaire.procedures_with_email_notifications).to eq([procedure]) }
+ it { expect(instructeur.procedures_with_email_notifications).to eq([procedure]) }
end
end
end
diff --git a/spec/controllers/instructeurs/recherche_controller_spec.rb b/spec/controllers/instructeurs/recherche_controller_spec.rb
index a54c97c1d..7c10224e2 100644
--- a/spec/controllers/instructeurs/recherche_controller_spec.rb
+++ b/spec/controllers/instructeurs/recherche_controller_spec.rb
@@ -1,19 +1,19 @@
require 'spec_helper'
-describe Gestionnaires::RechercheController, type: :controller do
+describe Instructeurs::RechercheController, type: :controller do
let(:dossier) { create(:dossier, :en_construction) }
let(:dossier2) { create(:dossier, :en_construction, procedure: dossier.procedure) }
- let(:gestionnaire) { create(:gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
- before { gestionnaire.procedures << dossier2.procedure }
+ before { instructeur.procedures << dossier2.procedure }
describe 'GET #index' do
- before { sign_in gestionnaire }
+ before { sign_in instructeur }
subject { get :index, params: { q: query } }
describe 'by id' do
- context 'when gestionnaire own the dossier' do
+ context 'when instructeur own the dossier' do
let(:query) { dossier.id }
it { is_expected.to have_http_status(200) }
@@ -25,7 +25,7 @@ describe Gestionnaires::RechercheController, type: :controller do
end
end
- context 'when gestionnaire do not own the dossier' do
+ context 'when instructeur do not own the dossier' do
let(:dossier3) { create(:dossier, :en_construction) }
let(:query) { dossier3.id }
diff --git a/spec/controllers/instructeurs/sessions_controller_spec.rb b/spec/controllers/instructeurs/sessions_controller_spec.rb
index 729be4939..28da270a2 100644
--- a/spec/controllers/instructeurs/sessions_controller_spec.rb
+++ b/spec/controllers/instructeurs/sessions_controller_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
-describe Gestionnaires::SessionsController, type: :controller do
+describe Instructeurs::SessionsController, type: :controller do
before do
- @request.env["devise.mapping"] = Devise.mappings[:gestionnaire]
+ @request.env["devise.mapping"] = Devise.mappings[:instructeur]
end
describe '#create' do
diff --git a/spec/controllers/invites_controller_spec.rb b/spec/controllers/invites_controller_spec.rb
index 1242f2a95..cdeb70618 100644
--- a/spec/controllers/invites_controller_spec.rb
+++ b/spec/controllers/invites_controller_spec.rb
@@ -13,24 +13,24 @@ describe InvitesController, type: :controller do
subject { post :create, params: { dossier_id: dossier.id, invite_email: email } }
- context "when gestionnaire is signed_in" do
- let(:signed_in_profile) { create(:gestionnaire) }
+ context "when instructeur is signed_in" do
+ let(:signed_in_profile) { create(:instructeur) }
shared_examples_for "he can not create invitation" do
it { expect { subject rescue nil }.to change(Invite, :count).by(0) }
end
- context 'when gestionnaire has no access to dossier' do
+ context 'when instructeur has no access to dossier' do
it_behaves_like "he can not create invitation"
end
- context 'when gestionnaire is invited for avis on dossier' do
- before { Avis.create(gestionnaire: signed_in_profile, claimant: create(:gestionnaire), dossier: dossier) }
+ context 'when instructeur is invited for avis on dossier' do
+ before { Avis.create(instructeur: signed_in_profile, claimant: create(:instructeur), dossier: dossier) }
it_behaves_like "he can not create invitation"
end
- context 'when gestionnaire has access to dossier' do
+ context 'when instructeur has access to dossier' do
before do
signed_in_profile.procedures << dossier.procedure
end
diff --git a/spec/controllers/root_controller_spec.rb b/spec/controllers/root_controller_spec.rb
index b1f7fb15a..5843b5147 100644
--- a/spec/controllers/root_controller_spec.rb
+++ b/spec/controllers/root_controller_spec.rb
@@ -11,17 +11,17 @@ describe RootController, type: :controller do
it { expect(subject).to redirect_to(dossiers_path) }
end
- context 'when Gestionnaire is connected' do
- let(:gestionnaire) { create(:gestionnaire) }
+ context 'when Instructeur is connected' do
+ let(:instructeur) { create(:instructeur) }
let(:procedure) { create(:procedure, :published) }
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
before do
- gestionnaire.procedures << procedure
- sign_in gestionnaire
+ instructeur.procedures << procedure
+ sign_in instructeur
end
- it { expect(subject).to redirect_to(gestionnaire_procedures_path) }
+ it { expect(subject).to redirect_to(instructeur_procedures_path) }
end
context 'when Administrateur is connected' do
@@ -60,7 +60,7 @@ describe RootController, type: :controller do
subject
end
- it "won't have gestionnaire login link" do
+ it "won't have instructeur login link" do
expect(response.body).to have_css("a[href='#{new_user_session_path}']")
end
end
diff --git a/spec/controllers/sessions/sessions_controller_spec.rb b/spec/controllers/sessions/sessions_controller_spec.rb
index 5d8e5839d..a47746b07 100644
--- a/spec/controllers/sessions/sessions_controller_spec.rb
+++ b/spec/controllers/sessions/sessions_controller_spec.rb
@@ -8,7 +8,7 @@ describe Sessions::SessionsController, type: :controller do
end
let(:user) { create(:user) }
- let(:gestionnaire) { create(:gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
let(:administrateur) { create(:administrateur) }
describe '#create' do
@@ -35,16 +35,16 @@ describe Sessions::SessionsController, type: :controller do
end
end
- describe '#create with gestionnaire connected' do
+ describe '#create with instructeur connected' do
before do
- @request.env["devise.mapping"] = Devise.mappings[:gestionnaire]
+ @request.env["devise.mapping"] = Devise.mappings[:instructeur]
- allow_any_instance_of(described_class).to receive(:gestionnaire_signed_in?).and_return(true)
- allow_any_instance_of(described_class).to receive(:current_gestionnaire).and_return(gestionnaire)
+ allow_any_instance_of(described_class).to receive(:instructeur_signed_in?).and_return(true)
+ allow_any_instance_of(described_class).to receive(:current_instructeur).and_return(instructeur)
end
- it 'calls sign out for gestionnaire' do
- expect_any_instance_of(described_class).to receive(:sign_out).with(:gestionnaire)
+ it 'calls sign out for instructeur' do
+ expect_any_instance_of(described_class).to receive(:sign_out).with(:instructeur)
post :create
end
end
diff --git a/spec/controllers/users/confirmations_controller_spec.rb b/spec/controllers/users/confirmations_controller_spec.rb
index 9e49989ee..1944d1a6a 100644
--- a/spec/controllers/users/confirmations_controller_spec.rb
+++ b/spec/controllers/users/confirmations_controller_spec.rb
@@ -22,7 +22,7 @@ describe Users::ConfirmationsController, type: :controller do
it 'signs in the user after confirming its token' do
expect(controller.current_user).to eq(user)
- expect(controller.current_gestionnaire).to be(nil)
+ expect(controller.current_instructeur).to be(nil)
expect(controller.current_administrateur).to be(nil)
end
@@ -45,7 +45,7 @@ describe Users::ConfirmationsController, type: :controller do
it 'doesn’t sign in the user' do
expect(subject.current_user).to be(nil)
- expect(subject.current_gestionnaire).to be(nil)
+ expect(subject.current_instructeur).to be(nil)
expect(subject.current_administrateur).to be(nil)
end
diff --git a/spec/controllers/users/passwords_controller_spec.rb b/spec/controllers/users/passwords_controller_spec.rb
index 720ae1a21..2e8109a5a 100644
--- a/spec/controllers/users/passwords_controller_spec.rb
+++ b/spec/controllers/users/passwords_controller_spec.rb
@@ -15,7 +15,7 @@ describe Users::PasswordsController, type: :controller do
administrateur # make sure it's created
end
- it "also signs gestionnaire in" do
+ it "also signs instructeur in" do
put :update, params: {
user: {
reset_password_token: @token,
@@ -24,7 +24,7 @@ describe Users::PasswordsController, type: :controller do
}
}
expect(subject.current_user).to eq(user)
- expect(subject.current_gestionnaire.email).to eq(administrateur.email)
+ expect(subject.current_instructeur.email).to eq(administrateur.email)
end
it "also signs administrateur in" do
diff --git a/spec/controllers/users/sessions_controller_spec.rb b/spec/controllers/users/sessions_controller_spec.rb
index eb7081c9a..40bb9b045 100644
--- a/spec/controllers/users/sessions_controller_spec.rb
+++ b/spec/controllers/users/sessions_controller_spec.rb
@@ -9,16 +9,16 @@ describe Users::SessionsController, type: :controller do
end
describe '#create' do
- context "when the user is also a gestionnaire and an administrateur" do
+ context "when the user is also a instructeur and an administrateur" do
let!(:administrateur) { create(:administrateur, email: email, password: password) }
- let(:gestionnaire) { administrateur.gestionnaire }
+ let(:instructeur) { administrateur.instructeur }
let(:trusted_device) { true }
let(:send_password) { password }
before do
Flipflop::FeatureSet.current.test!.switch!(:enable_email_login_token, true)
allow(controller).to receive(:trusted_device?).and_return(trusted_device)
- allow(GestionnaireMailer).to receive(:send_login_token).and_return(double(deliver_later: true))
+ allow(InstructeurMailer).to receive(:send_login_token).and_return(double(deliver_later: true))
end
subject do
@@ -35,23 +35,23 @@ describe Users::SessionsController, type: :controller do
expect(controller).to redirect_to(root_path)
expect(controller.current_user).to eq(user)
- expect(controller.current_gestionnaire).to eq(gestionnaire)
+ expect(controller.current_instructeur).to eq(instructeur)
expect(controller.current_administrateur).to eq(administrateur)
expect(user.loged_in_with_france_connect).to eq(nil)
end
end
context 'when the device is trusted' do
- it 'signs in as user, gestionnaire and adminstrateur' do
+ it 'signs in as user, instructeur and adminstrateur' do
subject
expect(response.redirect?).to be(true)
expect(controller).not_to redirect_to link_sent_path(email: email)
- # TODO when signing in as non-administrateur, and not starting a demarche, log in to gestionnaire path
- # expect(controller).to redirect_to gestionnaire_procedures_path
+ # TODO when signing in as non-administrateur, and not starting a demarche, log in to instructeur path
+ # expect(controller).to redirect_to instructeur_procedures_path
expect(controller.current_user).to eq(user)
- expect(controller.current_gestionnaire).to eq(gestionnaire)
+ expect(controller.current_instructeur).to eq(instructeur)
expect(controller.current_administrateur).to eq(administrateur)
expect(user.loged_in_with_france_connect).to be(nil)
end
@@ -65,7 +65,7 @@ describe Users::SessionsController, type: :controller do
expect(response.unauthorized?).to be(true)
expect(controller.current_user).to be(nil)
- expect(controller.current_gestionnaire).to be(nil)
+ expect(controller.current_instructeur).to be(nil)
expect(controller.current_administrateur).to be(nil)
end
end
@@ -103,9 +103,9 @@ describe Users::SessionsController, type: :controller do
end
end
- context "when associated gestionnaire" do
+ context "when associated instructeur" do
let(:user) { create(:user, email: 'unique@plop.com', password: 'démarches-simplifiées-pwd') }
- let(:gestionnaire) { create(:gestionnaire, email: 'unique@plop.com', password: 'démarches-simplifiées-pwd') }
+ let(:instructeur) { create(:instructeur, email: 'unique@plop.com', password: 'démarches-simplifiées-pwd') }
it 'signs user out' do
sign_in user
@@ -114,20 +114,20 @@ describe Users::SessionsController, type: :controller do
expect(subject.current_user).to be(nil)
end
- it 'signs gestionnaire out' do
- sign_in gestionnaire
+ it 'signs instructeur out' do
+ sign_in instructeur
delete :destroy
expect(@response.redirect?).to be(true)
- expect(subject.current_gestionnaire).to be(nil)
+ expect(subject.current_instructeur).to be(nil)
end
- it 'signs user + gestionnaire out' do
+ it 'signs user + instructeur out' do
sign_in user
- sign_in gestionnaire
+ sign_in instructeur
delete :destroy
expect(@response.redirect?).to be(true)
expect(subject.current_user).to be(nil)
- expect(subject.current_gestionnaire).to be(nil)
+ expect(subject.current_instructeur).to be(nil)
end
it 'signs user out from france connect' do
@@ -141,14 +141,14 @@ describe Users::SessionsController, type: :controller do
context "when associated administrateur" do
let(:administrateur) { create(:administrateur, email: 'unique@plop.com') }
- it 'signs user + gestionnaire + administrateur out' do
+ it 'signs user + instructeur + administrateur out' do
sign_in user
- sign_in administrateur.gestionnaire
+ sign_in administrateur.instructeur
sign_in administrateur
delete :destroy
expect(@response.redirect?).to be(true)
expect(subject.current_user).to be(nil)
- expect(subject.current_gestionnaire).to be(nil)
+ expect(subject.current_instructeur).to be(nil)
expect(subject.current_administrateur).to be(nil)
end
end
@@ -174,56 +174,56 @@ describe Users::SessionsController, type: :controller do
end
describe '#sign_in_by_link' do
- context 'when the gestionnaire has non other account' do
- let(:gestionnaire) { create(:gestionnaire) }
- let!(:good_jeton) { gestionnaire.create_trusted_device_token }
+ context 'when the instructeur has non other account' do
+ let(:instructeur) { create(:instructeur) }
+ let!(:good_jeton) { instructeur.create_trusted_device_token }
let(:logged) { false }
before do
if logged
- sign_in gestionnaire
+ sign_in instructeur
end
allow(controller).to receive(:trust_device)
allow(controller).to receive(:send_login_token_or_bufferize)
- post :sign_in_by_link, params: { id: gestionnaire.id, jeton: jeton }
+ post :sign_in_by_link, params: { id: instructeur.id, jeton: jeton }
end
- context 'when the gestionnaire is not logged in' do
+ context 'when the instructeur is not logged in' do
context 'when the token is valid' do
let(:jeton) { good_jeton }
it { is_expected.to redirect_to new_user_session_path }
- it { expect(controller.current_gestionnaire).to be_nil }
+ it { expect(controller.current_instructeur).to be_nil }
it { expect(controller).to have_received(:trust_device) }
end
context 'when the token is invalid' do
let(:jeton) { 'invalid_token' }
- it { is_expected.to redirect_to link_sent_path(email: gestionnaire.email) }
- it { expect(controller.current_gestionnaire).to be_nil }
+ it { is_expected.to redirect_to link_sent_path(email: instructeur.email) }
+ it { expect(controller.current_instructeur).to be_nil }
it { expect(controller).not_to have_received(:trust_device) }
it { expect(controller).to have_received(:send_login_token_or_bufferize) }
end
end
- context 'when the gestionnaire is logged in' do
+ context 'when the instructeur is logged in' do
let(:logged) { true }
context 'when the token is valid' do
let(:jeton) { good_jeton }
- # redirect to root_path, then redirect to gestionnaire_procedures_path (see root_controller)
+ # redirect to root_path, then redirect to instructeur_procedures_path (see root_controller)
it { is_expected.to redirect_to root_path }
- it { expect(controller.current_gestionnaire).to eq(gestionnaire) }
+ it { expect(controller.current_instructeur).to eq(instructeur) }
it { expect(controller).to have_received(:trust_device) }
end
context 'when the token is invalid' do
let(:jeton) { 'invalid_token' }
- it { is_expected.to redirect_to link_sent_path(email: gestionnaire.email) }
- it { expect(controller.current_gestionnaire).to eq(gestionnaire) }
+ it { is_expected.to redirect_to link_sent_path(email: instructeur.email) }
+ it { expect(controller.current_instructeur).to eq(instructeur) }
it { expect(controller).not_to have_received(:trust_device) }
it { expect(controller).to have_received(:send_login_token_or_bufferize) }
end
diff --git a/spec/controllers/users/user_controller_spec.rb b/spec/controllers/users/user_controller_spec.rb
index 4ab899460..7f6c2b1f1 100644
--- a/spec/controllers/users/user_controller_spec.rb
+++ b/spec/controllers/users/user_controller_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Users::UserController, type: :controller do
- describe 'before actions: authenticate_gestionnaire!' do
+ describe 'before actions: authenticate_instructeur!' do
it 'is present' do
before_actions = Users::UserController
._process_action_callbacks
diff --git a/spec/factories/administrateur.rb b/spec/factories/administrateur.rb
index 2d327e43f..7d7fec92b 100644
--- a/spec/factories/administrateur.rb
+++ b/spec/factories/administrateur.rb
@@ -5,7 +5,7 @@ FactoryBot.define do
password { 'mon chien aime les bananes' }
after(:create) do |admin|
- create(:gestionnaire, email: admin.email, password: admin.password)
+ create(:instructeur, email: admin.email, password: admin.password)
end
end
diff --git a/spec/factories/avis.rb b/spec/factories/avis.rb
index b7f4f556e..aeec523d3 100644
--- a/spec/factories/avis.rb
+++ b/spec/factories/avis.rb
@@ -3,8 +3,8 @@ FactoryBot.define do
introduction { 'Bonjour, merci de me donner votre avis sur ce dossier' }
before(:create) do |avis, _evaluator|
- if !avis.gestionnaire
- avis.gestionnaire = create :gestionnaire
+ if !avis.instructeur
+ avis.instructeur = create :instructeur
end
end
@@ -16,7 +16,7 @@ FactoryBot.define do
before(:create) do |avis, _evaluator|
if !avis.claimant
- avis.claimant = create :gestionnaire
+ avis.claimant = create :instructeur
end
end
diff --git a/spec/factories/dossier.rb b/spec/factories/dossier.rb
index a138f3842..7f90b5689 100644
--- a/spec/factories/dossier.rb
+++ b/spec/factories/dossier.rb
@@ -62,7 +62,7 @@ FactoryBot.define do
trait :followed do
after(:create) do |dossier, _evaluator|
- g = create(:gestionnaire)
+ g = create(:instructeur)
g.followed_dossiers << dossier
end
end
diff --git a/spec/factories/instructeur.rb b/spec/factories/instructeur.rb
index 41edb55b4..bb72b16e2 100644
--- a/spec/factories/instructeur.rb
+++ b/spec/factories/instructeur.rb
@@ -1,7 +1,7 @@
FactoryBot.define do
- sequence(:gestionnaire_email) { |n| "gest#{n}@gest.com" }
- factory :gestionnaire do
- email { generate(:gestionnaire_email) }
+ sequence(:instructeur_email) { |n| "gest#{n}@gest.com" }
+ factory :instructeur do
+ email { generate(:instructeur_email) }
password { 'démarches-simplifiées-pwd' }
end
end
diff --git a/spec/factories/procedure.rb b/spec/factories/procedure.rb
index 26ea304dd..2c79126a1 100644
--- a/spec/factories/procedure.rb
+++ b/spec/factories/procedure.rb
@@ -56,9 +56,9 @@ FactoryBot.define do
end
end
- trait :with_gestionnaire do
+ trait :with_instructeur do
after(:build) do |procedure, _evaluator|
- procedure.gestionnaires << create(:gestionnaire)
+ procedure.instructeurs << create(:instructeur)
end
end
diff --git a/spec/features/help_spec.rb b/spec/features/help_spec.rb
index 511090c5f..dda56baac 100644
--- a/spec/features/help_spec.rb
+++ b/spec/features/help_spec.rb
@@ -77,15 +77,15 @@ feature 'Getting help:' do
end
end
- context 'as a gestionnaire' do
- let(:gestionnaire) { create(:gestionnaire) }
+ context 'as a instructeur' do
+ let(:instructeur) { create(:instructeur) }
before do
- login_as gestionnaire, scope: :gestionnaire
+ login_as instructeur, scope: :instructeur
end
scenario 'a Help menu is visible on signed-in pages' do
- visit gestionnaire_procedures_path
+ visit instructeur_procedures_path
within('.new-header') do
expect(page).to have_help_menu
end
diff --git a/spec/features/instructeurs/instructeur_spec.rb b/spec/features/instructeurs/instructeur_spec.rb
index bac3eaef2..60b33e95c 100644
--- a/spec/features/instructeurs/instructeur_spec.rb
+++ b/spec/features/instructeurs/instructeur_spec.rb
@@ -1,27 +1,27 @@
require 'spec_helper'
-feature 'The gestionnaire part' do
+feature 'The instructeur part' do
include ActiveJob::TestHelper
let(:password) { 'démarches-simplifiées-pwd' }
- let!(:gestionnaire) { create(:gestionnaire, password: password) }
+ let!(:instructeur) { create(:instructeur, password: password) }
- let!(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
+ let!(:procedure) { create(:procedure, :published, instructeurs: [instructeur]) }
let!(:dossier) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure) }
before do
Flipflop::FeatureSet.current.test!.switch!(:enable_email_login_token, true)
end
- context 'when the gestionnaire is also a user' do
- let!(:user) { create(:user, email: gestionnaire.email, password: password) }
+ context 'when the instructeur is also a user' do
+ let!(:user) { create(:user, email: instructeur.email, password: password) }
- scenario 'a gestionnaire can fill a dossier' do
+ scenario 'a instructeur can fill a dossier' do
visit commencer_path(path: procedure.path)
click_on 'J’ai déjà un compte'
expect(page).to have_current_path new_user_session_path
- sign_in_with(gestionnaire.email, password, true)
+ sign_in_with(instructeur.email, password, true)
expect(page).to have_current_path(commencer_path(path: procedure.path))
click_on 'Commencer la démarche'
@@ -32,16 +32,16 @@ feature 'The gestionnaire part' do
end
end
- scenario 'A gestionnaire can accept a dossier', :js do
- log_in(gestionnaire.email, password)
+ scenario 'A instructeur can accept a dossier', :js do
+ log_in(instructeur.email, password)
- expect(page).to have_current_path(gestionnaire_procedures_path)
+ expect(page).to have_current_path(instructeur_procedures_path)
click_on procedure.libelle
- expect(page).to have_current_path(gestionnaire_procedure_path(procedure))
+ expect(page).to have_current_path(instructeur_procedure_path(procedure))
click_on dossier.user.email
- expect(page).to have_current_path(gestionnaire_dossier_path(procedure, dossier))
+ expect(page).to have_current_path(instructeur_dossier_path(procedure, dossier))
click_on 'En construction'
accept_confirm do
@@ -73,36 +73,36 @@ feature 'The gestionnaire part' do
expect(dossier.motivation).to eq('a good reason')
end
- scenario 'A gestionnaire can follow/unfollow a dossier' do
- log_in(gestionnaire.email, password)
+ scenario 'A instructeur can follow/unfollow a dossier' do
+ log_in(instructeur.email, password)
click_on procedure.libelle
test_statut_bar(a_suivre: 1, tous_les_dossiers: 1)
dossier_present?(dossier.id, 'en construction')
click_on 'Suivre le dossier'
- expect(page).to have_current_path(gestionnaire_procedure_path(procedure))
+ expect(page).to have_current_path(instructeur_procedure_path(procedure))
test_statut_bar(suivi: 1, tous_les_dossiers: 1)
expect(page).to have_text('Aucun dossier')
click_on 'suivi'
- expect(page).to have_current_path(gestionnaire_procedure_path(procedure, statut: 'suivis'))
+ expect(page).to have_current_path(instructeur_procedure_path(procedure, statut: 'suivis'))
dossier_present?(dossier.id, 'en construction')
click_on 'Ne plus suivre'
- expect(page).to have_current_path(gestionnaire_procedure_path(procedure, statut: 'suivis'))
+ expect(page).to have_current_path(instructeur_procedure_path(procedure, statut: 'suivis'))
test_statut_bar(a_suivre: 1, tous_les_dossiers: 1)
expect(page).to have_text('Aucun dossier')
end
- scenario 'A gestionnaire can use avis' do
- log_in(gestionnaire.email, password)
+ scenario 'A instructeur can use avis' do
+ log_in(instructeur.email, password)
click_on procedure.libelle
click_on dossier.user.email
click_on 'Avis externes'
- expect(page).to have_current_path(avis_gestionnaire_dossier_path(procedure, dossier))
+ expect(page).to have_current_path(avis_instructeur_dossier_path(procedure, dossier))
expert_email = 'expert@tps.com'
@@ -113,24 +113,24 @@ feature 'The gestionnaire part' do
log_out
avis = dossier.avis.first
- test_mail(expert_email, sign_up_gestionnaire_avis_path(avis, expert_email))
+ test_mail(expert_email, sign_up_instructeur_avis_path(avis, expert_email))
avis_sign_up(avis, expert_email)
- expect(page).to have_current_path(gestionnaire_avis_index_path)
+ expect(page).to have_current_path(instructeur_avis_index_path)
expect(page).to have_text('avis à donner 1')
expect(page).to have_text('avis donnés 0')
click_on dossier.user.email
- expect(page).to have_current_path(gestionnaire_avis_path(dossier.avis.first))
+ expect(page).to have_current_path(instructeur_avis_path(dossier.avis.first))
within(:css, '.tabs') do
click_on 'Avis'
end
- expect(page).to have_current_path(instruction_gestionnaire_avis_path(dossier.avis.first))
+ expect(page).to have_current_path(instruction_instructeur_avis_path(dossier.avis.first))
within(:css, '.give-avis') do
- expect(page).to have_text("Demandeur : #{gestionnaire.email}")
+ expect(page).to have_text("Demandeur : #{instructeur.email}")
expect(page).to have_text('a good introduction')
expect(page).to have_text('Cet avis est confidentiel')
fill_in 'avis_answer', with: 'a great answer'
@@ -139,7 +139,7 @@ feature 'The gestionnaire part' do
log_out
- log_in(gestionnaire.email, password, check_email: false)
+ log_in(instructeur.email, password, check_email: false)
click_on procedure.libelle
click_on dossier.user.email
@@ -148,38 +148,38 @@ feature 'The gestionnaire part' do
expect(page).to have_text('a great answer')
end
- scenario 'A gestionnaire can see the personnes impliquées' do
- gestionnaire2 = FactoryBot.create(:gestionnaire, password: password)
+ scenario 'A instructeur can see the personnes impliquées' do
+ instructeur2 = FactoryBot.create(:instructeur, password: password)
- log_in(gestionnaire.email, password)
+ log_in(instructeur.email, password)
click_on procedure.libelle
click_on dossier.user.email
click_on 'Avis externes'
- expect(page).to have_current_path(avis_gestionnaire_dossier_path(procedure, dossier))
+ expect(page).to have_current_path(avis_instructeur_dossier_path(procedure, dossier))
expert_email = 'expert@tps.com'
ask_confidential_avis(expert_email, 'a good introduction')
- expert_email = gestionnaire2.email
+ expert_email = instructeur2.email
ask_confidential_avis(expert_email, 'a good introduction')
click_on 'Personnes impliquées'
expect(page).to have_text(expert_email)
- expect(page).to have_text(gestionnaire2.email)
+ expect(page).to have_text(instructeur2.email)
end
- scenario 'A gestionnaire can send a dossier to several instructeurs', js: true do
- instructeur_2 = FactoryBot.create(:gestionnaire)
- instructeur_3 = FactoryBot.create(:gestionnaire)
- procedure.gestionnaires << [instructeur_2, instructeur_3]
+ scenario 'A instructeur can send a dossier to several instructeurs', js: true do
+ instructeur_2 = FactoryBot.create(:instructeur)
+ instructeur_3 = FactoryBot.create(:instructeur)
+ procedure.instructeurs << [instructeur_2, instructeur_3]
send_dossier = double()
- expect(GestionnaireMailer).to receive(:send_dossier).and_return(send_dossier).twice
+ expect(InstructeurMailer).to receive(:send_dossier).and_return(send_dossier).twice
expect(send_dossier).to receive(:deliver_later).twice
- log_in(gestionnaire.email, password)
+ log_in(instructeur.email, password)
click_on procedure.libelle
click_on dossier.user.email
@@ -203,7 +203,7 @@ feature 'The gestionnaire part' do
sign_in_with(email, password, check_email)
- expect(page).to have_current_path(gestionnaire_procedures_path)
+ expect(page).to have_current_path(instructeur_procedures_path)
end
def log_out
@@ -236,10 +236,10 @@ feature 'The gestionnaire part' do
end
def avis_sign_up(avis, email)
- visit sign_up_gestionnaire_avis_path(avis, email)
- fill_in 'gestionnaire_password', with: 'démarches-simplifiées-pwd'
+ visit sign_up_instructeur_avis_path(avis, email)
+ fill_in 'instructeur_password', with: 'démarches-simplifiées-pwd'
click_on 'Créer un compte'
- expect(page).to have_current_path(gestionnaire_avis_index_path)
+ expect(page).to have_current_path(instructeur_avis_index_path)
end
def dossier_present?(id, statut)
diff --git a/spec/features/instructeurs/procedure_filters_spec.rb b/spec/features/instructeurs/procedure_filters_spec.rb
index 8ac88e567..8ae435ee5 100644
--- a/spec/features/instructeurs/procedure_filters_spec.rb
+++ b/spec/features/instructeurs/procedure_filters_spec.rb
@@ -2,7 +2,7 @@ require "spec_helper"
feature "procedure filters" do
let(:procedure) { create(:procedure, :published, :with_type_de_champ) }
- let(:gestionnaire) { create(:gestionnaire, procedures: [procedure]) }
+ let(:instructeur) { create(:instructeur, procedures: [procedure]) }
let!(:type_de_champ) { procedure.types_de_champ.first }
let!(:new_unfollow_dossier) { create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_instruction)) }
let!(:champ) { Champ.find_by(type_de_champ_id: type_de_champ.id, dossier_id: new_unfollow_dossier.id) }
@@ -12,8 +12,8 @@ feature "procedure filters" do
before do
champ.update(value: "Mon champ rempli")
champ_2.update(value: "Mon autre champ rempli différemment")
- login_as gestionnaire, scope: :gestionnaire
- visit gestionnaire_procedure_path(procedure)
+ login_as instructeur, scope: :instructeur
+ visit instructeur_procedure_path(procedure)
end
scenario "should display demandeur by default" do
diff --git a/spec/helpers/dossier_link_helper_spec.rb b/spec/helpers/dossier_link_helper_spec.rb
index e92e862af..7190603a7 100644
--- a/spec/helpers/dossier_link_helper_spec.rb
+++ b/spec/helpers/dossier_link_helper_spec.rb
@@ -1,10 +1,10 @@
describe DossierLinkHelper do
describe "#dossier_linked_path" do
- context "when no access as a gestionnaire" do
- let(:gestionnaire) { create(:gestionnaire) }
+ context "when no access as a instructeur" do
+ let(:instructeur) { create(:instructeur) }
let(:dossier) { create(:dossier) }
- it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to be_nil }
+ it { expect(helper.dossier_linked_path(instructeur, dossier)).to be_nil }
end
context "when no access as a user" do
@@ -14,21 +14,21 @@ describe DossierLinkHelper do
it { expect(helper.dossier_linked_path(user, dossier)).to be_nil }
end
- context "when access as gestionnaire" do
+ context "when access as instructeur" do
let(:dossier) { create(:dossier) }
- let(:gestionnaire) { create(:gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
- before { dossier.procedure.gestionnaires << gestionnaire }
+ before { dossier.procedure.instructeurs << instructeur }
- it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to eq(gestionnaire_dossier_path(dossier.procedure, dossier)) }
+ it { expect(helper.dossier_linked_path(instructeur, dossier)).to eq(instructeur_dossier_path(dossier.procedure, dossier)) }
end
context "when access as expert" do
let(:dossier) { create(:dossier) }
- let(:gestionnaire) { create(:gestionnaire) }
- let!(:avis) { create(:avis, dossier: dossier, gestionnaire: gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
+ let!(:avis) { create(:avis, dossier: dossier, instructeur: instructeur) }
- it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to eq(gestionnaire_avis_path(avis)) }
+ it { expect(helper.dossier_linked_path(instructeur, dossier)).to eq(instructeur_avis_path(avis)) }
end
context "when access as user" do
diff --git a/spec/jobs/auto_archive_procedure_job_spec.rb b/spec/jobs/auto_archive_procedure_job_spec.rb
index 8e0225357..f1ab46bb3 100644
--- a/spec/jobs/auto_archive_procedure_job_spec.rb
+++ b/spec/jobs/auto_archive_procedure_job_spec.rb
@@ -1,10 +1,10 @@
require 'rails_helper'
RSpec.describe AutoArchiveProcedureJob, type: :job do
- let!(:procedure) { create(:procedure, :published, :with_gestionnaire, auto_archive_on: nil) }
- let!(:procedure_hier) { create(:procedure, :published, :with_gestionnaire, auto_archive_on: 1.day.ago) }
- let!(:procedure_aujourdhui) { create(:procedure, :published, :with_gestionnaire, auto_archive_on: Date.today) }
- let!(:procedure_demain) { create(:procedure, :published, :with_gestionnaire, auto_archive_on: 1.day.from_now) }
+ let!(:procedure) { create(:procedure, :published, :with_instructeur, auto_archive_on: nil) }
+ let!(:procedure_hier) { create(:procedure, :published, :with_instructeur, auto_archive_on: 1.day.ago) }
+ let!(:procedure_aujourdhui) { create(:procedure, :published, :with_instructeur, auto_archive_on: Date.today) }
+ let!(:procedure_demain) { create(:procedure, :published, :with_instructeur, auto_archive_on: 1.day.from_now) }
subject { AutoArchiveProcedureJob.new.perform }
diff --git a/spec/jobs/auto_receive_dossiers_for_procedure_job_spec.rb b/spec/jobs/auto_receive_dossiers_for_procedure_job_spec.rb
index 517a6dde9..404e9e32a 100644
--- a/spec/jobs/auto_receive_dossiers_for_procedure_job_spec.rb
+++ b/spec/jobs/auto_receive_dossiers_for_procedure_job_spec.rb
@@ -5,7 +5,7 @@ RSpec.describe AutoReceiveDossiersForProcedureJob, type: :job do
let(:date) { Time.utc(2017, 9, 1, 10, 5, 0) }
let(:instruction_date) { date + 120 }
- let(:procedure) { create(:procedure, :with_gestionnaire) }
+ let(:procedure) { create(:procedure, :with_instructeur) }
let(:nouveau_dossier1) { create(:dossier, :en_construction, procedure: procedure) }
let(:nouveau_dossier2) { create(:dossier, :en_construction, procedure: procedure) }
let(:dossier_recu) { create(:dossier, :en_instruction, procedure: procedure) }
diff --git a/spec/jobs/declarative_procedures_job_spec.rb b/spec/jobs/declarative_procedures_job_spec.rb
index ed17b5149..f70e80a42 100644
--- a/spec/jobs/declarative_procedures_job_spec.rb
+++ b/spec/jobs/declarative_procedures_job_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe DeclarativeProceduresJob, type: :job do
let(:instruction_date) { date + 120 }
let(:state) { nil }
- let(:procedure) { create(:procedure, :with_gestionnaire, declarative_with_state: state) }
+ let(:procedure) { create(:procedure, :with_instructeur, declarative_with_state: state) }
let(:nouveau_dossier1) { create(:dossier, :en_construction, procedure: procedure) }
let(:nouveau_dossier2) { create(:dossier, :en_construction, procedure: procedure) }
let(:dossier_recu) { create(:dossier, :en_instruction, procedure: procedure) }
diff --git a/spec/jobs/weekly_overview_job_spec.rb b/spec/jobs/weekly_overview_job_spec.rb
index abde4e76f..3e558c4c7 100644
--- a/spec/jobs/weekly_overview_job_spec.rb
+++ b/spec/jobs/weekly_overview_job_spec.rb
@@ -2,7 +2,7 @@ require 'rails_helper'
RSpec.describe WeeklyOverviewJob, type: :job do
describe 'perform' do
- let!(:gestionnaire) { create(:gestionnaire) }
+ let!(:instructeur) { create(:instructeur) }
let(:overview) { double('overview') }
let(:mailer_double) { double('mailer', deliver_later: true) }
@@ -14,35 +14,35 @@ RSpec.describe WeeklyOverviewJob, type: :job do
Rails.application.config.ds_weekly_overview = false
end
- context 'with one gestionnaire with one overview' do
+ context 'with one instructeur with one overview' do
before do
- expect_any_instance_of(Gestionnaire).to receive(:last_week_overview).and_return(overview)
- allow(GestionnaireMailer).to receive(:last_week_overview).and_return(mailer_double)
+ expect_any_instance_of(Instructeur).to receive(:last_week_overview).and_return(overview)
+ allow(InstructeurMailer).to receive(:last_week_overview).and_return(mailer_double)
WeeklyOverviewJob.new.perform
end
- it { expect(GestionnaireMailer).to have_received(:last_week_overview).with(gestionnaire) }
+ it { expect(InstructeurMailer).to have_received(:last_week_overview).with(instructeur) }
it { expect(mailer_double).to have_received(:deliver_later) }
end
- context 'with one gestionnaire with no overviews' do
+ context 'with one instructeur with no overviews' do
before do
- expect_any_instance_of(Gestionnaire).to receive(:last_week_overview).and_return(nil)
- allow(GestionnaireMailer).to receive(:last_week_overview)
+ expect_any_instance_of(Instructeur).to receive(:last_week_overview).and_return(nil)
+ allow(InstructeurMailer).to receive(:last_week_overview)
WeeklyOverviewJob.new.perform
end
- it { expect(GestionnaireMailer).not_to have_received(:last_week_overview) }
+ it { expect(InstructeurMailer).not_to have_received(:last_week_overview) }
end
end
context 'if the feature is disabled' do
before do
- allow(Gestionnaire).to receive(:all)
+ allow(Instructeur).to receive(:all)
WeeklyOverviewJob.new.perform
end
- it { expect(Gestionnaire).not_to receive(:all) }
+ it { expect(Instructeur).not_to receive(:all) }
end
end
end
diff --git a/spec/mailers/avis_mailer_spec.rb b/spec/mailers/avis_mailer_spec.rb
index 37d3e6674..06210d773 100644
--- a/spec/mailers/avis_mailer_spec.rb
+++ b/spec/mailers/avis_mailer_spec.rb
@@ -9,15 +9,15 @@ RSpec.describe AvisMailer, type: :mailer do
it { expect(subject.subject).to eq("Donnez votre avis sur le dossier nº #{avis.dossier.id} (#{avis.dossier.procedure.libelle})") }
it { expect(subject.body).to have_text("Vous avez été invité par\r\n#{avis.claimant.email}\r\nà donner votre avis sur le dossier nº #{avis.dossier.id} de la démarche :\r\n#{avis.dossier.procedure.libelle}") }
it { expect(subject.body).to include(avis.introduction) }
- it { expect(subject.body).to include(gestionnaire_avis_url(avis)) }
+ it { expect(subject.body).to include(instructeur_avis_url(avis)) }
context 'when the recipient is not already registered' do
before do
avis.email = 'instructeur@email.com'
- avis.gestionnaire = nil
+ avis.instructeur = nil
end
- it { expect(subject.body).to include(sign_up_gestionnaire_avis_url(avis.id, avis.email)) }
+ it { expect(subject.body).to include(sign_up_instructeur_avis_url(avis.id, avis.email)) }
end
end
end
diff --git a/spec/mailers/dossier_mailer_spec.rb b/spec/mailers/dossier_mailer_spec.rb
index 145d8b17f..d965ad9c7 100644
--- a/spec/mailers/dossier_mailer_spec.rb
+++ b/spec/mailers/dossier_mailer_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
RSpec.describe DossierMailer, type: :mailer do
- let(:to_email) { 'gestionnaire@exemple.gouv.fr' }
+ let(:to_email) { 'instructeur@exemple.gouv.fr' }
shared_examples 'a dossier notification' do
it 'includes the contact informations in the footer' do
diff --git a/spec/mailers/instructeur_mailer_spec.rb b/spec/mailers/instructeur_mailer_spec.rb
index 20e3c670c..aafaf85d2 100644
--- a/spec/mailers/instructeur_mailer_spec.rb
+++ b/spec/mailers/instructeur_mailer_spec.rb
@@ -1,7 +1,7 @@
-RSpec.describe GestionnaireMailer, type: :mailer do
+RSpec.describe InstructeurMailer, type: :mailer do
describe '#send_dossier' do
- let(:sender) { create(:gestionnaire) }
- let(:recipient) { create(:gestionnaire) }
+ let(:sender) { create(:instructeur) }
+ let(:recipient) { create(:instructeur) }
let(:dossier) { create(:dossier) }
subject { described_class.send_dossier(sender, dossier, recipient) }
@@ -10,8 +10,8 @@ RSpec.describe GestionnaireMailer, type: :mailer do
end
describe '#last_week_overview' do
- let(:gestionnaire) { create(:gestionnaire) }
- let(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
+ let(:instructeur) { create(:instructeur) }
+ let(:procedure) { create(:procedure, :published, instructeurs: [instructeur]) }
let(:dossier) { create(:dossier) }
let(:last_week_overview) do
procedure_overview = double('po',
@@ -30,13 +30,13 @@ RSpec.describe GestionnaireMailer, type: :mailer do
}
end
- before { allow(gestionnaire).to receive(:last_week_overview).and_return(last_week_overview) }
+ before { allow(instructeur).to receive(:last_week_overview).and_return(last_week_overview) }
- subject { described_class.last_week_overview(gestionnaire) }
+ subject { described_class.last_week_overview(instructeur) }
it { expect(subject.body).to include('Votre activité hebdomadaire') }
- context 'when the gestionnaire has no active procedures' do
+ context 'when the instructeur has no active procedures' do
let(:procedure) { nil }
let(:last_week_overview) { nil }
diff --git a/spec/mailers/previews/avis_mailer_preview.rb b/spec/mailers/previews/avis_mailer_preview.rb
index 72d715f93..0c61cef52 100644
--- a/spec/mailers/previews/avis_mailer_preview.rb
+++ b/spec/mailers/previews/avis_mailer_preview.rb
@@ -1,7 +1,7 @@
# Preview all emails at http://localhost:3000/rails/mailers/avis_mailer
class AvisMailerPreview < ActionMailer::Preview
def avis_invitation
- gestionaire = Gestionnaire.new(id: 1, email: 'jeanmichel.de-chauvigny@exemple.fr')
+ gestionaire = Instructeur.new(id: 1, email: 'jeanmichel.de-chauvigny@exemple.fr')
avis = Avis.new(id: 1, email: 'test@exemple.fr', claimant: gestionaire)
avis.dossier = Dossier.new(id: 1)
avis.dossier.procedure = Procedure.new(libelle: 'Démarche pour faire des marches')
diff --git a/spec/mailers/previews/instructeur_mailer_preview.rb b/spec/mailers/previews/instructeur_mailer_preview.rb
index eda8b78aa..b7b1c879f 100644
--- a/spec/mailers/previews/instructeur_mailer_preview.rb
+++ b/spec/mailers/previews/instructeur_mailer_preview.rb
@@ -1,22 +1,22 @@
-class GestionnaireMailerPreview < ActionMailer::Preview
+class InstructeurMailerPreview < ActionMailer::Preview
def last_week_overview
- GestionnaireMailer.last_week_overview(Gestionnaire.first)
+ InstructeurMailer.last_week_overview(Instructeur.first)
end
def send_dossier
- GestionnaireMailer.send_dossier(gestionnaire, Dossier.new(id: 10, procedure: procedure), target_gestionnaire)
+ InstructeurMailer.send_dossier(instructeur, Dossier.new(id: 10, procedure: procedure), target_instructeur)
end
def send_login_token
- GestionnaireMailer.send_login_token(gestionnaire, "token")
+ InstructeurMailer.send_login_token(instructeur, "token")
end
- def invite_gestionnaire
- GestionnaireMailer.invite_gestionnaire(gestionnaire, 'aedfa0d0')
+ def invite_instructeur
+ InstructeurMailer.invite_instructeur(instructeur, 'aedfa0d0')
end
- def user_to_gestionnaire
- GestionnaireMailer.user_to_gestionnaire(gestionnaire.email)
+ def user_to_instructeur
+ InstructeurMailer.user_to_instructeur(instructeur.email)
end
def send_notifications
@@ -34,17 +34,17 @@ class GestionnaireMailerPreview < ActionMailer::Preview
nb_notification: 1
}
]
- GestionnaireMailer.send_notifications(gestionnaire, data)
+ InstructeurMailer.send_notifications(instructeur, data)
end
private
- def gestionnaire
- Gestionnaire.new(id: 10, email: 'instructeur@administration.gouv.fr')
+ def instructeur
+ Instructeur.new(id: 10, email: 'instructeur@administration.gouv.fr')
end
- def target_gestionnaire
- Gestionnaire.new(id: 12, email: 'collegue@administration.gouv.fr')
+ def target_instructeur
+ Instructeur.new(id: 12, email: 'collegue@administration.gouv.fr')
end
def procedure
diff --git a/spec/models/administrateur_spec.rb b/spec/models/administrateur_spec.rb
index 0441454ca..ca705cc29 100644
--- a/spec/models/administrateur_spec.rb
+++ b/spec/models/administrateur_spec.rb
@@ -4,7 +4,7 @@ describe Administrateur, type: :model do
let(:administration) { create(:administration) }
describe 'assocations' do
- it { is_expected.to have_and_belong_to_many(:gestionnaires) }
+ it { is_expected.to have_and_belong_to_many(:instructeurs) }
it { is_expected.to have_many(:procedures) }
end
@@ -22,13 +22,13 @@ describe Administrateur, type: :model do
it 'syncs credentials to associated administrateur' do
administrateur = create(:administrateur)
- gestionnaire = administrateur.gestionnaire
+ instructeur = administrateur.instructeur
administrateur.update(email: 'whoami@plop.com', password: 'et encore un autre mdp')
- gestionnaire.reload
- expect(gestionnaire.email).to eq('whoami@plop.com')
- expect(gestionnaire.valid_password?('et encore un autre mdp')).to be(true)
+ instructeur.reload
+ expect(instructeur.email).to eq('whoami@plop.com')
+ expect(instructeur.valid_password?('et encore un autre mdp')).to be(true)
end
end
diff --git a/spec/models/administration_spec.rb b/spec/models/administration_spec.rb
index 77f3594f2..40a65fa83 100644
--- a/spec/models/administration_spec.rb
+++ b/spec/models/administration_spec.rb
@@ -20,10 +20,10 @@ describe Administration, type: :model do
expect(user).to be_present
end
- it 'creates a corresponding gestionnaire account for the email' do
+ it 'creates a corresponding instructeur account for the email' do
subject
- gestionnaire = Gestionnaire.find_by(email: valid_email)
- expect(gestionnaire).to be_present
+ instructeur = Instructeur.find_by(email: valid_email)
+ expect(instructeur).to be_present
end
context 'when there already is a user account with the same email' do
diff --git a/spec/models/avis_spec.rb b/spec/models/avis_spec.rb
index d55b4afd0..4b807644c 100644
--- a/spec/models/avis_spec.rb
+++ b/spec/models/avis_spec.rb
@@ -1,26 +1,26 @@
require 'rails_helper'
RSpec.describe Avis, type: :model do
- let(:claimant) { create(:gestionnaire) }
+ let(:claimant) { create(:instructeur) }
describe '#email_to_display' do
let(:invited_email) { 'invited@avis.com' }
let!(:avis) do
avis = create(:avis, email: invited_email, dossier: create(:dossier))
- avis.gestionnaire = nil
+ avis.instructeur = nil
avis
end
subject { avis.email_to_display }
- context 'when gestionnaire is not known' do
+ context 'when instructeur is not known' do
it { is_expected.to eq(invited_email) }
end
- context 'when gestionnaire is known' do
- let!(:avis) { create(:avis, email: nil, gestionnaire: create(:gestionnaire), dossier: create(:dossier)) }
+ context 'when instructeur is known' do
+ let!(:avis) { create(:avis, email: nil, instructeur: create(:instructeur), dossier: create(:dossier)) }
- it { is_expected.to eq(avis.gestionnaire.email) }
+ it { is_expected.to eq(avis.instructeur.email) }
end
end
@@ -36,14 +36,14 @@ RSpec.describe Avis, type: :model do
end
end
- describe ".link_avis_to_gestionnaire" do
- let(:gestionnaire) { create(:gestionnaire) }
+ describe ".link_avis_to_instructeur" do
+ let(:instructeur) { create(:instructeur) }
- subject { Avis.link_avis_to_gestionnaire(gestionnaire) }
+ subject { Avis.link_avis_to_instructeur(instructeur) }
- context 'when there are 2 avis linked by email to a gestionnaire' do
- let!(:avis) { create(:avis, email: gestionnaire.email, gestionnaire: nil) }
- let!(:avis2) { create(:avis, email: gestionnaire.email, gestionnaire: nil) }
+ context 'when there are 2 avis linked by email to a instructeur' do
+ let!(:avis) { create(:avis, email: instructeur.email, instructeur: nil) }
+ let!(:avis2) { create(:avis, email: instructeur.email, instructeur: nil) }
before do
subject
@@ -52,9 +52,9 @@ RSpec.describe Avis, type: :model do
end
it { expect(avis.email).to be_nil }
- it { expect(avis.gestionnaire).to eq(gestionnaire) }
+ it { expect(avis.instructeur).to eq(instructeur) }
it { expect(avis2.email).to be_nil }
- it { expect(avis2.gestionnaire).to eq(gestionnaire) }
+ it { expect(avis2.instructeur).to eq(instructeur) }
end
end
@@ -87,7 +87,7 @@ RSpec.describe Avis, type: :model do
end
end
- describe '#notify_gestionnaire' do
+ describe '#notify_instructeur' do
context 'when an avis is created' do
before do
avis_invitation_double = double('avis_invitation', deliver_later: true)
@@ -99,27 +99,27 @@ RSpec.describe Avis, type: :model do
end
end
- describe '#try_to_assign_gestionnaire' do
- let!(:gestionnaire) { create(:gestionnaire) }
+ describe '#try_to_assign_instructeur' do
+ let!(:instructeur) { create(:instructeur) }
let(:avis) { Avis.create(claimant: claimant, email: email, dossier: create(:dossier)) }
- context 'when the email belongs to a gestionnaire' do
- let(:email) { gestionnaire.email }
+ context 'when the email belongs to a instructeur' do
+ let(:email) { instructeur.email }
- it { expect(avis.gestionnaire).to eq(gestionnaire) }
+ it { expect(avis.instructeur).to eq(instructeur) }
it { expect(avis.email).to be_nil }
end
- context 'when the email does not belongs to a gestionnaire' do
+ context 'when the email does not belongs to a instructeur' do
let(:email) { 'unknown@email' }
- it { expect(avis.gestionnaire).to be_nil }
+ it { expect(avis.instructeur).to be_nil }
it { expect(avis.email).to eq(email) }
end
end
describe "email sanitization" do
- subject { Avis.create(claimant: claimant, email: email, dossier: create(:dossier), gestionnaire: create(:gestionnaire)) }
+ subject { Avis.create(claimant: claimant, email: email, dossier: create(:dossier), instructeur: create(:instructeur)) }
context "when there is no email" do
let(:email) { nil }
diff --git a/spec/models/commentaire_spec.rb b/spec/models/commentaire_spec.rb
index fe27728ea..cbce20d7f 100644
--- a/spec/models/commentaire_spec.rb
+++ b/spec/models/commentaire_spec.rb
@@ -46,9 +46,9 @@ describe Commentaire do
describe "#redacted_email" do
subject { commentaire.redacted_email }
- context 'with a commentaire created by a gestionnaire' do
- let(:commentaire) { build :commentaire, gestionnaire: gestionnaire }
- let(:gestionnaire) { build :gestionnaire, email: 'some_user@exemple.fr' }
+ context 'with a commentaire created by a instructeur' do
+ let(:commentaire) { build :commentaire, instructeur: instructeur }
+ let(:instructeur) { build :instructeur, email: 'some_user@exemple.fr' }
it { is_expected.to eq 'some_user' }
end
@@ -63,25 +63,25 @@ describe Commentaire do
describe "#notify" do
let(:procedure) { create(:procedure) }
- let(:gestionnaire) { create(:gestionnaire) }
- let(:assign_to) { create(:assign_to, gestionnaire: gestionnaire, procedure: procedure) }
+ let(:instructeur) { create(:instructeur) }
+ let(:assign_to) { create(:assign_to, instructeur: instructeur, procedure: procedure) }
let(:user) { create(:user) }
let(:dossier) { create(:dossier, :en_construction, procedure: procedure, user: user) }
let(:commentaire) { Commentaire.new(dossier: dossier, body: "Mon commentaire") }
- context "with a commentaire created by a gestionnaire" do
+ context "with a commentaire created by a instructeur" do
it "calls notify_user" do
expect(commentaire).to receive(:notify_user)
- commentaire.email = gestionnaire.email
+ commentaire.email = instructeur.email
commentaire.save
end
end
context "with a commentaire automatically created (notification)" do
- it "does not call notify_user or notify_gestionnaires" do
+ it "does not call notify_user or notify_instructeurs" do
expect(commentaire).not_to receive(:notify_user)
- expect(commentaire).not_to receive(:notify_gestionnaires)
+ expect(commentaire).not_to receive(:notify_instructeurs)
commentaire.email = CONTACT_EMAIL
commentaire.save
diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb
index c5ef481a4..8d56632c3 100644
--- a/spec/models/dossier_spec.rb
+++ b/spec/models/dossier_spec.rb
@@ -146,19 +146,19 @@ describe Dossier do
context 'when dossier is followed' do
let(:procedure) { create(:procedure, :with_type_de_champ, :with_type_de_champ_private) }
- let(:gestionnaire) { create(:gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
let(:date1) { 1.day.ago }
let(:date2) { 1.hour.ago }
let(:date3) { 1.minute.ago }
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure, en_construction_at: date1, en_instruction_at: date2, processed_at: date3, motivation: "Motivation") }
- let!(:follow) { create(:follow, gestionnaire: gestionnaire, dossier: dossier) }
+ let!(:follow) { create(:follow, instructeur: instructeur, dossier: dossier) }
- describe "followers_gestionnaires" do
- let(:non_following_gestionnaire) { create(:gestionnaire) }
- subject { dossier.followers_gestionnaires }
+ describe "followers_instructeurs" do
+ let(:non_following_instructeur) { create(:instructeur) }
+ subject { dossier.followers_instructeurs }
- it { expect(subject).to eq [gestionnaire] }
- it { expect(subject).not_to include(non_following_gestionnaire) }
+ it { expect(subject).to eq [instructeur] }
+ it { expect(subject).not_to include(non_following_instructeur) }
end
end
@@ -238,48 +238,48 @@ describe Dossier do
let!(:procedure) { create(:procedure, :published) }
let!(:dossier) { create(:dossier, procedure: procedure, state: Dossier.states.fetch(:en_construction)) }
- let!(:gestionnaire) { create(:gestionnaire, procedures: [procedure]) }
- let!(:expert_1) { create(:gestionnaire) }
- let!(:expert_2) { create(:gestionnaire) }
+ let!(:instructeur) { create(:instructeur, procedures: [procedure]) }
+ let!(:expert_1) { create(:instructeur) }
+ let!(:expert_2) { create(:instructeur) }
- context 'when there is a public advice asked from the dossiers gestionnaire' do
- let!(:avis) { Avis.create(dossier: dossier, claimant: gestionnaire, gestionnaire: expert_1, confidentiel: false) }
+ context 'when there is a public advice asked from the dossiers instructeur' do
+ let!(:avis) { Avis.create(dossier: dossier, claimant: instructeur, instructeur: expert_1, confidentiel: false) }
- it { expect(dossier.avis_for(gestionnaire)).to match([avis]) }
+ it { expect(dossier.avis_for(instructeur)).to match([avis]) }
it { expect(dossier.avis_for(expert_1)).to match([avis]) }
it { expect(dossier.avis_for(expert_2)).to match([avis]) }
end
- context 'when there is a private advice asked from the dossiers gestionnaire' do
- let!(:avis) { Avis.create(dossier: dossier, claimant: gestionnaire, gestionnaire: expert_1, confidentiel: true) }
+ context 'when there is a private advice asked from the dossiers instructeur' do
+ let!(:avis) { Avis.create(dossier: dossier, claimant: instructeur, instructeur: expert_1, confidentiel: true) }
- it { expect(dossier.avis_for(gestionnaire)).to match([avis]) }
+ it { expect(dossier.avis_for(instructeur)).to match([avis]) }
it { expect(dossier.avis_for(expert_1)).to match([avis]) }
it { expect(dossier.avis_for(expert_2)).to match([]) }
end
context 'when there is a public advice asked from one expert to another' do
- let!(:avis) { Avis.create(dossier: dossier, claimant: expert_1, gestionnaire: expert_2, confidentiel: false) }
+ let!(:avis) { Avis.create(dossier: dossier, claimant: expert_1, instructeur: expert_2, confidentiel: false) }
- it { expect(dossier.avis_for(gestionnaire)).to match([avis]) }
+ it { expect(dossier.avis_for(instructeur)).to match([avis]) }
it { expect(dossier.avis_for(expert_1)).to match([avis]) }
it { expect(dossier.avis_for(expert_2)).to match([avis]) }
end
context 'when there is a private advice asked from one expert to another' do
- let!(:avis) { Avis.create(dossier: dossier, claimant: expert_1, gestionnaire: expert_2, confidentiel: true) }
+ let!(:avis) { Avis.create(dossier: dossier, claimant: expert_1, instructeur: expert_2, confidentiel: true) }
- it { expect(dossier.avis_for(gestionnaire)).to match([avis]) }
+ it { expect(dossier.avis_for(instructeur)).to match([avis]) }
it { expect(dossier.avis_for(expert_1)).to match([avis]) }
it { expect(dossier.avis_for(expert_2)).to match([avis]) }
end
context 'when they are a lot of advice' do
- let!(:avis_1) { Avis.create(dossier: dossier, claimant: expert_1, gestionnaire: expert_2, confidentiel: false, created_at: Time.zone.parse('10/01/2010')) }
- let!(:avis_2) { Avis.create(dossier: dossier, claimant: expert_1, gestionnaire: expert_2, confidentiel: false, created_at: Time.zone.parse('9/01/2010')) }
- let!(:avis_3) { Avis.create(dossier: dossier, claimant: expert_1, gestionnaire: expert_2, confidentiel: false, created_at: Time.zone.parse('11/01/2010')) }
+ let!(:avis_1) { Avis.create(dossier: dossier, claimant: expert_1, instructeur: expert_2, confidentiel: false, created_at: Time.zone.parse('10/01/2010')) }
+ let!(:avis_2) { Avis.create(dossier: dossier, claimant: expert_1, instructeur: expert_2, confidentiel: false, created_at: Time.zone.parse('9/01/2010')) }
+ let!(:avis_3) { Avis.create(dossier: dossier, claimant: expert_1, instructeur: expert_2, confidentiel: false, created_at: Time.zone.parse('11/01/2010')) }
- it { expect(dossier.avis_for(gestionnaire)).to match([avis_2, avis_1, avis_3]) }
+ it { expect(dossier.avis_for(instructeur)).to match([avis_2, avis_1, avis_3]) }
it { expect(dossier.avis_for(expert_1)).to match([avis_2, avis_1, avis_3]) }
end
end
@@ -611,21 +611,21 @@ describe Dossier do
expect(last_operation.automatic_operation?).to be_falsey
end
- context 'where gestionnaires are following the dossier' do
+ context 'where instructeurs are following the dossier' do
let(:dossier) { create(:dossier, :en_construction, :followed) }
- let!(:non_following_gestionnaire) do
- non_following_gestionnaire = create(:gestionnaire)
- non_following_gestionnaire.procedures << dossier.procedure
- non_following_gestionnaire
+ let!(:non_following_instructeur) do
+ non_following_instructeur = create(:instructeur)
+ non_following_instructeur.procedures << dossier.procedure
+ non_following_instructeur
end
- it 'notifies the following gestionnaires' do
+ it 'notifies the following instructeurs' do
expect(DossierMailer).to have_received(:notify_deletion_to_administration).once
- expect(DossierMailer).to have_received(:notify_deletion_to_administration).with(deleted_dossier, dossier.followers_gestionnaires.first.email)
+ expect(DossierMailer).to have_received(:notify_deletion_to_administration).with(deleted_dossier, dossier.followers_instructeurs.first.email)
end
end
- context 'when there are no following gestionnaires' do
+ context 'when there are no following instructeurs' do
let(:dossier) { create(:dossier, :en_construction) }
it 'notifies the procedure administrateur' do
expect(DossierMailer).to have_received(:notify_deletion_to_administration).once
@@ -768,7 +768,7 @@ describe Dossier do
let(:dossier) { create(:dossier, :en_instruction) }
let(:last_operation) { dossier.dossier_operation_logs.last }
let(:operation_serialized) { JSON.parse(last_operation.serialized.download) }
- let!(:gestionnaire) { create(:gestionnaire) }
+ let!(:instructeur) { create(:instructeur) }
let!(:now) { Time.zone.parse('01/01/2100') }
let(:attestation) { Attestation.new }
@@ -777,7 +777,7 @@ describe Dossier do
allow(dossier).to receive(:build_attestation).and_return(attestation)
Timecop.freeze(now)
- dossier.accepter!(gestionnaire, 'motivation')
+ dossier.accepter!(instructeur, 'motivation')
dossier.reload
end
@@ -827,12 +827,12 @@ describe Dossier do
let(:dossier) { create(:dossier, :en_construction) }
let(:last_operation) { dossier.dossier_operation_logs.last }
let(:operation_serialized) { JSON.parse(last_operation.serialized.download) }
- let(:gestionnaire) { create(:gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
- before { dossier.passer_en_instruction!(gestionnaire) }
+ before { dossier.passer_en_instruction!(instructeur) }
it { expect(dossier.state).to eq('en_instruction') }
- it { expect(dossier.followers_gestionnaires).to include(gestionnaire) }
+ it { expect(dossier.followers_instructeurs).to include(instructeur) }
it { expect(last_operation.operation).to eq('passer_en_instruction') }
it { expect(last_operation.automatic_operation?).to be_falsey }
it { expect(operation_serialized['operation']).to eq('passer_en_instruction') }
@@ -844,11 +844,11 @@ describe Dossier do
let(:dossier) { create(:dossier, :en_construction) }
let(:last_operation) { dossier.dossier_operation_logs.last }
let(:operation_serialized) { JSON.parse(last_operation.serialized.download) }
- let(:gestionnaire) { create(:gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
before { dossier.passer_automatiquement_en_instruction! }
- it { expect(dossier.followers_gestionnaires).not_to include(gestionnaire) }
+ it { expect(dossier.followers_instructeurs).not_to include(instructeur) }
it { expect(last_operation.operation).to eq('passer_en_instruction') }
it { expect(last_operation.automatic_operation?).to be_truthy }
it { expect(operation_serialized['operation']).to eq('passer_en_instruction') }
@@ -948,14 +948,14 @@ describe Dossier do
describe '#repasser_en_instruction!' do
let(:dossier) { create(:dossier, :refuse, :with_attestation) }
- let!(:gestionnaire) { create(:gestionnaire) }
+ let!(:instructeur) { create(:instructeur) }
let(:last_operation) { dossier.dossier_operation_logs.last }
before do
Timecop.freeze
allow(DossierMailer).to receive(:notify_revert_to_instruction)
.and_return(double(deliver_later: true))
- dossier.repasser_en_instruction!(gestionnaire)
+ dossier.repasser_en_instruction!(instructeur)
dossier.reload
end
@@ -964,7 +964,7 @@ describe Dossier do
it { expect(dossier.motivation).to be_nil }
it { expect(dossier.attestation).to be_nil }
it { expect(last_operation.operation).to eq('repasser_en_instruction') }
- it { expect(JSON.parse(last_operation.serialized.download)['author']['email']).to eq(gestionnaire.email) }
+ it { expect(JSON.parse(last_operation.serialized.download)['author']['email']).to eq(instructeur.email) }
it { expect(DossierMailer).to have_received(:notify_revert_to_instruction).with(dossier) }
after { Timecop.return }
diff --git a/spec/models/instructeur_spec.rb b/spec/models/instructeur_spec.rb
index 5bbc561fb..f269565c6 100644
--- a/spec/models/instructeur_spec.rb
+++ b/spec/models/instructeur_spec.rb
@@ -1,11 +1,11 @@
require 'spec_helper'
-describe Gestionnaire, type: :model do
+describe Instructeur, type: :model do
let(:admin) { create :administrateur }
let!(:procedure) { create :procedure, :published, administrateur: admin }
let!(:procedure_2) { create :procedure, :published, administrateur: admin }
let!(:procedure_3) { create :procedure, :published, administrateur: admin }
- let(:gestionnaire) { create :gestionnaire, administrateurs: [admin] }
+ let(:instructeur) { create :instructeur, administrateurs: [admin] }
let!(:procedure_assign) { assign(procedure) }
before do
@@ -13,7 +13,7 @@ describe Gestionnaire, type: :model do
end
describe 'default features' do
- it { expect(gestionnaire.features).to eq({ "enable_email_login_token" => true }) }
+ it { expect(instructeur.features).to eq({ "enable_email_login_token" => true }) }
end
describe '#visible_procedures' do
@@ -30,7 +30,7 @@ describe Gestionnaire, type: :model do
assign(procedure_archived_automatically)
end
- subject { gestionnaire.visible_procedures }
+ subject { instructeur.visible_procedures }
it do
expect(subject).not_to include(procedure_not_assigned)
@@ -45,74 +45,74 @@ describe Gestionnaire, type: :model do
let(:dossier) { create :dossier }
let(:already_followed_dossier) { create :dossier }
- before { gestionnaire.followed_dossiers << already_followed_dossier }
+ before { instructeur.followed_dossiers << already_followed_dossier }
- context 'when a gestionnaire follow a dossier for the first time' do
- before { gestionnaire.follow(dossier) }
+ context 'when a instructeur follow a dossier for the first time' do
+ before { instructeur.follow(dossier) }
- it { expect(gestionnaire.follow?(dossier)).to be true }
+ it { expect(instructeur.follow?(dossier)).to be true }
end
- context 'when a gestionnaire follows a dossier already followed' do
- before { gestionnaire.follow(already_followed_dossier) }
+ context 'when a instructeur follows a dossier already followed' do
+ before { instructeur.follow(already_followed_dossier) }
- it { expect(gestionnaire.follow?(already_followed_dossier)).to be true }
+ it { expect(instructeur.follow?(already_followed_dossier)).to be true }
end
end
describe '#unfollow' do
let(:already_followed_dossier) { create(:dossier) }
- before { gestionnaire.followed_dossiers << already_followed_dossier }
+ before { instructeur.followed_dossiers << already_followed_dossier }
- context 'when a gestionnaire unfollow a dossier already followed' do
+ context 'when a instructeur unfollow a dossier already followed' do
before do
- gestionnaire.unfollow(already_followed_dossier)
+ instructeur.unfollow(already_followed_dossier)
already_followed_dossier.reload
end
- it { expect(gestionnaire.follow?(already_followed_dossier)).to be false }
- it { expect(gestionnaire.previously_followed_dossiers).to include(already_followed_dossier) }
+ it { expect(instructeur.follow?(already_followed_dossier)).to be false }
+ it { expect(instructeur.previously_followed_dossiers).to include(already_followed_dossier) }
end
end
describe '#follow?' do
let!(:dossier) { create :dossier, procedure: procedure }
- subject { gestionnaire.follow?(dossier) }
+ subject { instructeur.follow?(dossier) }
- context 'when gestionnaire follow a dossier' do
+ context 'when instructeur follow a dossier' do
before do
- create :follow, dossier_id: dossier.id, gestionnaire_id: gestionnaire.id
+ create :follow, dossier_id: dossier.id, instructeur_id: instructeur.id
end
it { is_expected.to be_truthy }
end
- context 'when gestionnaire not follow a dossier' do
+ context 'when instructeur not follow a dossier' do
it { is_expected.to be_falsey }
end
end
describe "#assign_to_procedure" do
- subject { gestionnaire.assign_to_procedure(procedure_to_assign) }
+ subject { instructeur.assign_to_procedure(procedure_to_assign) }
context "with a procedure not already assigned" do
let(:procedure_to_assign) { procedure_3 }
it { is_expected.to be_truthy }
- it { expect { subject }.to change(gestionnaire.procedures, :count) }
+ it { expect { subject }.to change(instructeur.procedures, :count) }
end
context "with an already assigned procedure" do
let(:procedure_to_assign) { procedure }
it { is_expected.to be_falsey }
- it { expect { subject }.not_to change(gestionnaire.procedures, :count) }
+ it { expect { subject }.not_to change(instructeur.procedures, :count) }
end
end
describe "#remove_from_procedure" do
- subject { gestionnaire.remove_from_procedure(procedure_to_remove) }
+ subject { instructeur.remove_from_procedure(procedure_to_remove) }
context "with an assigned procedure" do
let(:procedure_to_remove) { procedure }
@@ -143,10 +143,10 @@ describe Gestionnaire, type: :model do
context 'unified login' do
it 'syncs credentials to associated user' do
- gestionnaire = create(:gestionnaire)
- user = create(:user, email: gestionnaire.email)
+ instructeur = create(:instructeur)
+ user = create(:user, email: instructeur.email)
- gestionnaire.update(email: 'whoami@plop.com', password: 'démarches-simplifiées-pwd')
+ instructeur.update(email: 'whoami@plop.com', password: 'démarches-simplifiées-pwd')
user.reload
expect(user.email).to eq('whoami@plop.com')
@@ -155,9 +155,9 @@ describe Gestionnaire, type: :model do
it 'syncs credentials to associated administrateur' do
admin = create(:administrateur)
- gestionnaire = admin.gestionnaire
+ instructeur = admin.instructeur
- gestionnaire.update(password: 'démarches-simplifiées-pwd')
+ instructeur.update(password: 'démarches-simplifiées-pwd')
admin.reload
expect(admin.valid_password?('démarches-simplifiées-pwd')).to be(true)
@@ -165,8 +165,8 @@ describe Gestionnaire, type: :model do
end
describe 'last_week_overview' do
- let!(:gestionnaire2) { create(:gestionnaire) }
- subject { gestionnaire2.last_week_overview }
+ let!(:instructeur2) { create(:instructeur) }
+ subject { instructeur2.last_week_overview }
let(:friday) { Time.zone.local(2017, 5, 12) }
let(:monday) { Time.zone.now.beginning_of_week }
@@ -174,25 +174,25 @@ describe Gestionnaire, type: :model do
after { Timecop.return }
context 'when no procedure published was active last week' do
- let!(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire2], libelle: 'procedure') }
- context 'when the gestionnaire has no notifications' do
+ let!(:procedure) { create(:procedure, :published, instructeurs: [instructeur2], libelle: 'procedure') }
+ context 'when the instructeur has no notifications' do
it { is_expected.to eq(nil) }
end
end
context 'when a procedure published was active' do
- let!(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire2], libelle: 'procedure') }
+ let!(:procedure) { create(:procedure, :published, instructeurs: [instructeur2], libelle: 'procedure') }
let(:procedure_overview) { double('procedure_overview', 'had_some_activities?'.to_sym => true) }
before :each do
expect_any_instance_of(Procedure).to receive(:procedure_overview).and_return(procedure_overview)
end
- it { expect(gestionnaire2.last_week_overview[:procedure_overviews]).to match([procedure_overview]) }
+ it { expect(instructeur2.last_week_overview[:procedure_overviews]).to match([procedure_overview]) }
end
context 'when a procedure not published was active with no notifications' do
- let!(:procedure) { create(:procedure, gestionnaires: [gestionnaire2], libelle: 'procedure') }
+ let!(:procedure) { create(:procedure, instructeurs: [instructeur2], libelle: 'procedure') }
let(:procedure_overview) { double('procedure_overview', 'had_some_activities?'.to_sym => true) }
before :each do
@@ -204,7 +204,7 @@ describe Gestionnaire, type: :model do
end
describe "procedure_presentation_and_errors_for_procedure_id" do
- let(:procedure_presentation_and_errors) { gestionnaire.procedure_presentation_and_errors_for_procedure_id(procedure_id) }
+ let(:procedure_presentation_and_errors) { instructeur.procedure_presentation_and_errors_for_procedure_id(procedure_id) }
let(:procedure_presentation) { procedure_presentation_and_errors.first }
let(:errors) { procedure_presentation_and_errors.second }
@@ -237,11 +237,11 @@ describe Gestionnaire, type: :model do
describe '#notifications_for_dossier' do
let!(:dossier) { create(:dossier, :followed, state: Dossier.states.fetch(:en_construction)) }
- let(:gestionnaire) { dossier.follows.first.gestionnaire }
+ let(:instructeur) { dossier.follows.first.instructeur }
- subject { gestionnaire.notifications_for_dossier(dossier) }
+ subject { instructeur.notifications_for_dossier(dossier) }
- context 'when the gestionnaire has just followed the dossier' do
+ context 'when the instructeur has just followed the dossier' do
it { is_expected.to match({ demande: false, annotations_privees: false, avis: false, messagerie: false }) }
end
@@ -280,20 +280,20 @@ describe Gestionnaire, type: :model do
describe '#notifications_for_procedure' do
let!(:dossier) { create(:dossier, :followed, state: Dossier.states.fetch(:en_construction)) }
- let(:gestionnaire) { dossier.follows.first.gestionnaire }
+ let(:instructeur) { dossier.follows.first.instructeur }
let(:procedure) { dossier.procedure }
- let!(:gestionnaire_2) { create(:gestionnaire, procedures: [procedure]) }
+ let!(:instructeur_2) { create(:instructeur, procedures: [procedure]) }
let!(:dossier_on_procedure_2) { create(:dossier, :followed, state: Dossier.states.fetch(:en_construction)) }
- let!(:gestionnaire_on_procedure_2) { dossier_on_procedure_2.follows.first.gestionnaire }
+ let!(:instructeur_on_procedure_2) { dossier_on_procedure_2.follows.first.instructeur }
before do
- gestionnaire_2.followed_dossiers << dossier
+ instructeur_2.followed_dossiers << dossier
end
- subject { gestionnaire.notifications_for_procedure(procedure) }
+ subject { instructeur.notifications_for_procedure(procedure) }
- context 'when the gestionnaire has just followed the dossier' do
+ context 'when the instructeur has just followed the dossier' do
it { is_expected.to match([]) }
end
@@ -301,8 +301,8 @@ describe Gestionnaire, type: :model do
before { dossier.champs.first.update_attribute('value', 'toto') }
it { is_expected.to match([dossier.id]) }
- it { expect(gestionnaire_2.notifications_for_procedure(procedure)).to match([dossier.id]) }
- it { expect(gestionnaire_on_procedure_2.notifications_for_procedure(procedure)).to match([]) }
+ it { expect(instructeur_2.notifications_for_procedure(procedure)).to match([dossier.id]) }
+ it { expect(instructeur_on_procedure_2.notifications_for_procedure(procedure)).to match([]) }
context 'and there is a modification on private champs' do
before { dossier.champs_private.first.update_attribute('value', 'toto') }
@@ -310,13 +310,13 @@ describe Gestionnaire, type: :model do
it { is_expected.to match([dossier.id]) }
end
- context 'when gestionnaire update it s public champs last seen' do
- let(:follow) { gestionnaire.follows.find_by(dossier: dossier) }
+ context 'when instructeur update it s public champs last seen' do
+ let(:follow) { instructeur.follows.find_by(dossier: dossier) }
before { follow.update_attribute('demande_seen_at', Time.zone.now) }
it { is_expected.to match([]) }
- it { expect(gestionnaire_2.notifications_for_procedure(procedure)).to match([dossier.id]) }
+ it { expect(instructeur_2.notifications_for_procedure(procedure)).to match([dossier.id]) }
end
end
@@ -355,10 +355,10 @@ describe Gestionnaire, type: :model do
describe '#notifications_per_procedure' do
let!(:dossier) { create(:dossier, :followed, state: Dossier.states.fetch(:en_construction)) }
- let(:gestionnaire) { dossier.follows.first.gestionnaire }
+ let(:instructeur) { dossier.follows.first.instructeur }
let(:procedure) { dossier.procedure }
- subject { gestionnaire.notifications_per_procedure }
+ subject { instructeur.notifications_per_procedure }
context 'when there is a modification on public champs' do
before { dossier.champs.first.update_attribute('value', 'toto') }
@@ -369,15 +369,15 @@ describe Gestionnaire, type: :model do
describe '#mark_tab_as_seen' do
let!(:dossier) { create(:dossier, :followed, state: Dossier.states.fetch(:en_construction)) }
- let(:gestionnaire) { dossier.follows.first.gestionnaire }
+ let(:instructeur) { dossier.follows.first.instructeur }
let(:freeze_date) { Time.zone.parse('12/12/2012') }
context 'when demande is acknowledged' do
- let(:follow) { gestionnaire.follows.find_by(dossier: dossier) }
+ let(:follow) { instructeur.follows.find_by(dossier: dossier) }
before do
Timecop.freeze(freeze_date)
- gestionnaire.mark_tab_as_seen(dossier, :demande)
+ instructeur.mark_tab_as_seen(dossier, :demande)
end
after { Timecop.return }
@@ -386,39 +386,39 @@ describe Gestionnaire, type: :model do
end
describe '#young_login_token?' do
- let!(:gestionnaire) { create(:gestionnaire) }
+ let!(:instructeur) { create(:instructeur) }
context 'when there is a token' do
- let!(:good_token) { gestionnaire.create_trusted_device_token }
+ let!(:good_token) { instructeur.create_trusted_device_token }
context 'when the token has just been created' do
- it { expect(gestionnaire.young_login_token?).to be true }
+ it { expect(instructeur.young_login_token?).to be true }
end
context 'when the token is a bit old' do
- before { gestionnaire.trusted_device_tokens.first.update(created_at: (TrustedDeviceToken::LOGIN_TOKEN_YOUTH + 1.minute).ago) }
- it { expect(gestionnaire.young_login_token?).to be false }
+ before { instructeur.trusted_device_tokens.first.update(created_at: (TrustedDeviceToken::LOGIN_TOKEN_YOUTH + 1.minute).ago) }
+ it { expect(instructeur.young_login_token?).to be false }
end
end
context 'when there are no token' do
- it { expect(gestionnaire.young_login_token?).to be_falsey }
+ it { expect(instructeur.young_login_token?).to be_falsey }
end
end
describe '#email_notification_data' do
- let(:gestionnaire) { create(:gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
let(:procedure_to_assign) { create(:procedure) }
before do
- create(:assign_to, gestionnaire: gestionnaire, procedure: procedure_to_assign, email_notifications_enabled: true)
+ create(:assign_to, instructeur: instructeur, procedure: procedure_to_assign, email_notifications_enabled: true)
end
context 'when a dossier in construction exists' do
let!(:dossier) { create(:dossier, procedure: procedure_to_assign, state: Dossier.states.fetch(:en_construction)) }
it do
- expect(gestionnaire.email_notification_data).to eq([
+ expect(instructeur.email_notification_data).to eq([
{
nb_en_construction: 1,
nb_notification: 0,
@@ -431,13 +431,13 @@ describe Gestionnaire, type: :model do
context 'when a notification exists' do
before do
- allow(gestionnaire).to receive(:notifications_for_procedure)
+ allow(instructeur).to receive(:notifications_for_procedure)
.with(procedure_to_assign, :all)
.and_return([1, 2, 3])
end
it do
- expect(gestionnaire.email_notification_data).to eq([
+ expect(instructeur.email_notification_data).to eq([
{
nb_en_construction: 0,
nb_notification: 3,
@@ -449,13 +449,13 @@ describe Gestionnaire, type: :model do
end
context 'otherwise' do
- it { expect(gestionnaire.email_notification_data).to eq([]) }
+ it { expect(instructeur.email_notification_data).to eq([]) }
end
end
private
def assign(procedure_to_assign)
- create :assign_to, gestionnaire: gestionnaire, procedure: procedure_to_assign
+ create :assign_to, instructeur: instructeur, procedure: procedure_to_assign
end
end
diff --git a/spec/models/procedure_presentation_spec.rb b/spec/models/procedure_presentation_spec.rb
index b5011fd43..e11d9cd64 100644
--- a/spec/models/procedure_presentation_spec.rb
+++ b/spec/models/procedure_presentation_spec.rb
@@ -61,7 +61,7 @@ describe ProcedurePresentation do
{ "label" => 'En construction le', "table" => 'self', "column" => 'en_construction_at' },
{ "label" => 'Mis à jour le', "table" => 'self', "column" => 'updated_at' },
{ "label" => 'Demandeur', "table" => 'user', "column" => 'email' },
- { "label" => 'Email instructeur', "table" => 'followers_gestionnaires', "column" => 'email' },
+ { "label" => 'Email instructeur', "table" => 'followers_instructeurs', "column" => 'email' },
{ "label" => 'SIREN', "table" => 'etablissement', "column" => 'entreprise_siren' },
{ "label" => 'Forme juridique', "table" => 'etablissement', "column" => 'entreprise_forme_juridique' },
{ "label" => 'Nom commercial', "table" => 'etablissement', "column" => 'entreprise_nom_commercial' },
@@ -197,13 +197,13 @@ describe ProcedurePresentation do
it { is_expected.to eq('75008') }
end
- context 'for followers_gestionnaires table' do
- let(:table) { 'followers_gestionnaires' }
+ context 'for followers_instructeurs table' do
+ let(:table) { 'followers_instructeurs' }
let(:column) { 'email' }
let(:dossier) { create(:dossier, procedure: procedure) }
- let!(:follow1) { create(:follow, dossier: dossier, gestionnaire: create(:gestionnaire, email: 'user1@host')) }
- let!(:follow2) { create(:follow, dossier: dossier, gestionnaire: create(:gestionnaire, email: 'user2@host')) }
+ let!(:follow1) { create(:follow, dossier: dossier, instructeur: create(:instructeur, email: 'user1@host')) }
+ let!(:follow2) { create(:follow, dossier: dossier, instructeur: create(:instructeur, email: 'user2@host')) }
it { is_expected.to eq('user1@host, user2@host') }
end
@@ -232,12 +232,12 @@ describe ProcedurePresentation do
end
describe '#sorted_ids' do
- let(:gestionnaire) { create(:gestionnaire) }
- let(:assign_to) { create(:assign_to, procedure: procedure, gestionnaire: gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
+ let(:assign_to) { create(:assign_to, procedure: procedure, instructeur: instructeur) }
let(:sort) { { 'table' => table, 'column' => column, 'order' => order } }
let(:procedure_presentation) { ProcedurePresentation.create(assign_to: assign_to, sort: sort) }
- subject { procedure_presentation.sorted_ids(procedure.dossiers, gestionnaire) }
+ subject { procedure_presentation.sorted_ids(procedure.dossiers, instructeur) }
context 'for notifications table' do
let(:table) { 'notifications' }
@@ -249,7 +249,7 @@ describe ProcedurePresentation do
before do
notified_dossier.champs.first.touch(time: Time.zone.local(2018, 9, 20))
- create(:follow, gestionnaire: gestionnaire, dossier: notified_dossier, demande_seen_at: Time.zone.local(2018, 9, 10))
+ create(:follow, instructeur: instructeur, dossier: notified_dossier, demande_seen_at: Time.zone.local(2018, 9, 10))
notified_dossier.touch(time: Time.zone.local(2018, 9, 20))
recent_dossier.touch(time: Time.zone.local(2018, 9, 25))
older_dossier.touch(time: Time.zone.local(2018, 5, 13))
@@ -644,15 +644,15 @@ describe ProcedurePresentation do
end
end
- context 'for followers_gestionnaires table' do
- let(:filter) { [{ 'table' => 'followers_gestionnaires', 'column' => 'email', 'value' => 'keepmail' }] }
+ context 'for followers_instructeurs table' do
+ let(:filter) { [{ 'table' => 'followers_instructeurs', 'column' => 'email', 'value' => 'keepmail' }] }
let!(:kept_dossier) { create(:dossier, procedure: procedure) }
let!(:discarded_dossier) { create(:dossier, procedure: procedure) }
before do
- create(:follow, dossier: kept_dossier, gestionnaire: create(:gestionnaire, email: 'me@keepmail.com'))
- create(:follow, dossier: discarded_dossier, gestionnaire: create(:gestionnaire, email: 'me@discard.com'))
+ create(:follow, dossier: kept_dossier, instructeur: create(:instructeur, email: 'me@keepmail.com'))
+ create(:follow, dossier: discarded_dossier, instructeur: create(:instructeur, email: 'me@discard.com'))
end
it { is_expected.to contain_exactly(kept_dossier.id) }
@@ -660,15 +660,15 @@ describe ProcedurePresentation do
context 'with multiple search values' do
let(:filter) do
[
- { 'table' => 'followers_gestionnaires', 'column' => 'email', 'value' => 'keepmail' },
- { 'table' => 'followers_gestionnaires', 'column' => 'email', 'value' => 'beta.gouv.fr' }
+ { 'table' => 'followers_instructeurs', 'column' => 'email', 'value' => 'keepmail' },
+ { 'table' => 'followers_instructeurs', 'column' => 'email', 'value' => 'beta.gouv.fr' }
]
end
let(:other_kept_dossier) { create(:dossier, procedure: procedure) }
before do
- create(:follow, dossier: other_kept_dossier, gestionnaire: create(:gestionnaire, email: 'bazinga@beta.gouv.fr'))
+ create(:follow, dossier: other_kept_dossier, instructeur: create(:instructeur, email: 'bazinga@beta.gouv.fr'))
end
it 'returns every dossier that matches any of the search criteria for a given column' do
@@ -695,7 +695,7 @@ describe ProcedurePresentation do
expect(displayed_dossier.association(:user)).not_to be_loaded
expect(displayed_dossier.association(:individual)).not_to be_loaded
expect(displayed_dossier.association(:etablissement)).not_to be_loaded
- expect(displayed_dossier.association(:followers_gestionnaires)).not_to be_loaded
+ expect(displayed_dossier.association(:followers_instructeurs)).not_to be_loaded
end
end
@@ -711,7 +711,7 @@ describe ProcedurePresentation do
expect(displayed_dossier.association(:user)).not_to be_loaded
expect(displayed_dossier.association(:individual)).not_to be_loaded
expect(displayed_dossier.association(:etablissement)).not_to be_loaded
- expect(displayed_dossier.association(:followers_gestionnaires)).not_to be_loaded
+ expect(displayed_dossier.association(:followers_instructeurs)).not_to be_loaded
end
end
@@ -725,7 +725,7 @@ describe ProcedurePresentation do
expect(displayed_dossier.association(:user)).to be_loaded
expect(displayed_dossier.association(:individual)).not_to be_loaded
expect(displayed_dossier.association(:etablissement)).not_to be_loaded
- expect(displayed_dossier.association(:followers_gestionnaires)).not_to be_loaded
+ expect(displayed_dossier.association(:followers_instructeurs)).not_to be_loaded
end
end
@@ -739,7 +739,7 @@ describe ProcedurePresentation do
expect(displayed_dossier.association(:user)).not_to be_loaded
expect(displayed_dossier.association(:individual)).to be_loaded
expect(displayed_dossier.association(:etablissement)).not_to be_loaded
- expect(displayed_dossier.association(:followers_gestionnaires)).not_to be_loaded
+ expect(displayed_dossier.association(:followers_instructeurs)).not_to be_loaded
end
end
@@ -753,21 +753,21 @@ describe ProcedurePresentation do
expect(displayed_dossier.association(:user)).not_to be_loaded
expect(displayed_dossier.association(:individual)).not_to be_loaded
expect(displayed_dossier.association(:etablissement)).to be_loaded
- expect(displayed_dossier.association(:followers_gestionnaires)).not_to be_loaded
+ expect(displayed_dossier.association(:followers_instructeurs)).not_to be_loaded
end
end
- context 'for followers_gestionnaires' do
- let(:table) { 'followers_gestionnaires' }
+ context 'for followers_instructeurs' do
+ let(:table) { 'followers_instructeurs' }
let(:column) { 'email' }
- it 'preloads the followers_gestionnaires relation' do
+ it 'preloads the followers_instructeurs relation' do
expect(displayed_dossier.association(:champs)).not_to be_loaded
expect(displayed_dossier.association(:champs_private)).not_to be_loaded
expect(displayed_dossier.association(:user)).not_to be_loaded
expect(displayed_dossier.association(:individual)).not_to be_loaded
expect(displayed_dossier.association(:etablissement)).not_to be_loaded
- expect(displayed_dossier.association(:followers_gestionnaires)).to be_loaded
+ expect(displayed_dossier.association(:followers_instructeurs)).to be_loaded
end
end
@@ -781,7 +781,7 @@ describe ProcedurePresentation do
expect(displayed_dossier.association(:user)).not_to be_loaded
expect(displayed_dossier.association(:individual)).not_to be_loaded
expect(displayed_dossier.association(:etablissement)).not_to be_loaded
- expect(displayed_dossier.association(:followers_gestionnaires)).not_to be_loaded
+ expect(displayed_dossier.association(:followers_instructeurs)).not_to be_loaded
end
end
end
diff --git a/spec/models/procedure_spec.rb b/spec/models/procedure_spec.rb
index a3b26e422..3ef660938 100644
--- a/spec/models/procedure_spec.rb
+++ b/spec/models/procedure_spec.rb
@@ -401,7 +401,7 @@ describe Procedure do
subject { @procedure }
it { expect(subject.parent_procedure).to eq(procedure) }
- it { expect(subject.gestionnaires.pluck(:email)).to eq([administrateur.email]) }
+ it { expect(subject.instructeurs.pluck(:email)).to eq([administrateur.email]) }
it 'should duplicate specific objects with different id' do
expect(subject.id).not_to eq(procedure.id)
@@ -648,21 +648,21 @@ describe Procedure do
let(:procedure) { create(:procedure) }
let!(:dossier) { create(:dossier, procedure: procedure) }
let!(:dossier2) { create(:dossier, procedure: procedure) }
- let(:gestionnaire) { create(:gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
it { expect(Dossier.count).to eq(2) }
it { expect(Dossier.all).to include(dossier, dossier2) }
context "when hidding procedure" do
before do
- gestionnaire.followed_dossiers << dossier
+ instructeur.followed_dossiers << dossier
procedure.hide!
- gestionnaire.reload
+ instructeur.reload
end
it { expect(procedure.dossiers.count).to eq(0) }
it { expect(Dossier.count).to eq(0) }
- it { expect(gestionnaire.followed_dossiers).not_to include(dossier) }
+ it { expect(instructeur.followed_dossiers).not_to include(dossier) }
end
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 6be340be8..581feccf3 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -24,7 +24,7 @@ describe User, type: :model do
let(:owner) { create(:user) }
let(:dossier) { create(:dossier, user: owner) }
let(:invite_user) { create(:user) }
- let(:invite_gestionnaire) { create(:user) }
+ let(:invite_instructeur) { create(:user) }
subject { user.owns?(dossier) }
@@ -74,7 +74,7 @@ describe User, type: :model do
let(:owner) { create(:user) }
let(:dossier) { create(:dossier, user: owner) }
let(:invite_user) { create(:user) }
- let(:invite_gestionnaire) { create(:user) }
+ let(:invite_instructeur) { create(:user) }
subject { user.owns_or_invite?(dossier) }
@@ -102,16 +102,16 @@ describe User, type: :model do
end
context 'unified login' do
- it 'syncs credentials to associated gestionnaire' do
+ it 'syncs credentials to associated instructeur' do
user = create(:user)
- gestionnaire = create(:gestionnaire, email: user.email)
+ instructeur = create(:instructeur, email: user.email)
user.update(email: 'whoami@plop.com', password: 'démarches-simplifiées2')
user.confirm
- gestionnaire.reload
- expect(gestionnaire.email).to eq('whoami@plop.com')
- expect(gestionnaire.valid_password?('démarches-simplifiées2')).to be(true)
+ instructeur.reload
+ expect(instructeur.email).to eq('whoami@plop.com')
+ expect(instructeur.valid_password?('démarches-simplifiées2')).to be(true)
end
it 'syncs credentials to associated administrateur' do
diff --git a/spec/services/administrateur_usage_statistics_service_spec.rb b/spec/services/administrateur_usage_statistics_service_spec.rb
index be9b4ce2a..2aaa44ff5 100644
--- a/spec/services/administrateur_usage_statistics_service_spec.rb
+++ b/spec/services/administrateur_usage_statistics_service_spec.rb
@@ -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
diff --git a/spec/services/dossier_search_service_spec.rb b/spec/services/dossier_search_service_spec.rb
index d9c70d8d3..c89473b85 100644
--- a/spec/services/dossier_search_service_spec.rb
+++ b/spec/services/dossier_search_service_spec.rb
@@ -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) }
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb
index c690c2ba6..e2375c8a5 100644
--- a/spec/services/notification_service_spec.rb
+++ b/spec/services/notification_service_spec.rb
@@ -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
diff --git a/spec/support/feature_helpers.rb b/spec/support/feature_helpers.rb
index 9fb8019c8..14d24442a 100644
--- a/spec/support/feature_helpers.rb
+++ b/spec/support/feature_helpers.rb
@@ -7,9 +7,9 @@ module FeatureHelpers
user
end
- def login_gestionnaire
- gestionnaire = create(:gestionnaire)
- login_as gestionnaire, scope: :gestionnaire
+ def login_instructeur
+ instructeur = create(:instructeur)
+ login_as instructeur, scope: :instructeur
end
def create_dossier
@@ -28,10 +28,10 @@ module FeatureHelpers
if sign_in_by_link
mail = ActionMailer::Base.deliveries.last
message = mail.html_part.body.raw_source
- gestionnaire_id = message[/\".+\/connexion-par-jeton\/(.+)\?jeton=(.*)\"/, 1]
+ instructeur_id = message[/\".+\/connexion-par-jeton\/(.+)\?jeton=(.*)\"/, 1]
jeton = message[/\".+\/connexion-par-jeton\/(.+)\?jeton=(.*)\"/, 2]
- visit sign_in_by_link_path(gestionnaire_id, jeton: jeton)
+ visit sign_in_by_link_path(instructeur_id, jeton: jeton)
end
end
diff --git a/spec/views/admin/assigns/show.html.haml_spec.rb b/spec/views/admin/assigns/show.html.haml_spec.rb
index 63331862f..3136d94a7 100644
--- a/spec/views/admin/assigns/show.html.haml_spec.rb
+++ b/spec/views/admin/assigns/show.html.haml_spec.rb
@@ -4,12 +4,12 @@ describe 'admin/assigns/show.html.haml', type: :view do
let(:admin) { create(:administrateur) }
let(:procedure) { create :procedure, administrateur: admin }
- let(:assign_gestionnaires) { procedure.gestionnaires }
- let(:not_assign_gestionnaires) { admin.gestionnaires.where.not(id: assign_gestionnaires.ids) }
+ let(:assign_instructeurs) { procedure.instructeurs }
+ let(:not_assign_instructeurs) { admin.instructeurs.where.not(id: assign_instructeurs.ids) }
before do
assign(:procedure, procedure)
- assign(:gestionnaire, Gestionnaire.new)
+ assign(:instructeur, Instructeur.new)
assign(:instructeurs_assign, (smart_listing_create :instructeurs_assign,
assign_instructeurs,
@@ -35,12 +35,12 @@ describe 'admin/assigns/show.html.haml', type: :view do
end
context 'when administrateur have two instructeur' do
- let!(:instructeur_1) { create :gestionnaire, email: 'plop@plop.com', administrateurs: [admin] }
- let!(:instructeur_2) { create :gestionnaire, email: 'plip@plop.com', administrateurs: [admin] }
+ let!(:instructeur_1) { create :instructeur, email: 'plop@plop.com', administrateurs: [admin] }
+ let!(:instructeur_2) { create :instructeur, email: 'plip@plop.com', administrateurs: [admin] }
before do
- not_assign_gestionnaires.reload
- assign_gestionnaires.reload
+ not_assign_instructeurs.reload
+ assign_instructeurs.reload
assign(:instructeurs_assign, (smart_listing_create :instructeurs_assign,
assign_instructeurs,
diff --git a/spec/views/admin/instructeurs/index.html.haml_spec.rb b/spec/views/admin/instructeurs/index.html.haml_spec.rb
index 35b32f211..80e3d2ec6 100644
--- a/spec/views/admin/instructeurs/index.html.haml_spec.rb
+++ b/spec/views/admin/instructeurs/index.html.haml_spec.rb
@@ -1,17 +1,17 @@
require 'spec_helper'
-describe 'admin/gestionnaires/index.html.haml', type: :view do
+describe 'admin/instructeurs/index.html.haml', type: :view do
let(:admin) { create(:administrateur) }
before do
- assign(:gestionnaires, (smart_listing_create :gestionnaires,
- admin.gestionnaires,
- partial: "admin/gestionnaires/list",
+ assign(:instructeurs, (smart_listing_create :instructeurs,
+ admin.instructeurs,
+ partial: "admin/instructeurs/list",
array: true))
- assign(:gestionnaire, Gestionnaire.new())
+ assign(:instructeur, Instructeur.new())
end
- context 'Aucun gestionnaire' do
+ context 'Aucun instructeur' do
before do
render
end
@@ -20,11 +20,11 @@ describe 'admin/gestionnaires/index.html.haml', type: :view do
context 'Ajout d\'un instructeur' do
before do
- create(:gestionnaire, administrateurs: [admin])
+ create(:instructeur, administrateurs: [admin])
admin.reload
- assign(:gestionnaires, (smart_listing_create :gestionnaires,
- admin.gestionnaires,
- partial: "admin/gestionnaires/list",
+ assign(:instructeurs, (smart_listing_create :instructeurs,
+ admin.instructeurs,
+ partial: "admin/instructeurs/list",
array: true))
render
end
diff --git a/spec/views/admin/procedures/show.html.haml_spec.rb b/spec/views/admin/procedures/show.html.haml_spec.rb
index 9c5c8deef..b2fb5dc17 100644
--- a/spec/views/admin/procedures/show.html.haml_spec.rb
+++ b/spec/views/admin/procedures/show.html.haml_spec.rb
@@ -23,7 +23,7 @@ describe 'admin/procedures/show.html.haml', type: :view do
context 'when procedure have a gestionnare affected' do
before do
- create :assign_to, gestionnaire: create(:gestionnaire), procedure: procedure
+ create :assign_to, instructeur: create(:instructeur), procedure: procedure
render
end
diff --git a/spec/views/instructeur/avis/instruction.html.haml_spec.rb b/spec/views/instructeur/avis/instruction.html.haml_spec.rb
index 56030ed69..5d5800b4b 100644
--- a/spec/views/instructeur/avis/instruction.html.haml_spec.rb
+++ b/spec/views/instructeur/avis/instruction.html.haml_spec.rb
@@ -1,10 +1,10 @@
-describe 'gestionnaires/avis/instruction.html.haml', type: :view do
+describe 'instructeurs/avis/instruction.html.haml', type: :view do
let(:avis) { create(:avis, confidentiel: confidentiel) }
before do
assign(:avis, avis)
@dossier = create(:dossier, :accepte)
- allow(view).to receive(:current_gestionnaire).and_return(avis.gestionnaire)
+ allow(view).to receive(:current_instructeur).and_return(avis.instructeur)
end
subject { render }
diff --git a/spec/views/instructeur/dossiers/_envoyer_dossier_block.html.haml_spec.rb b/spec/views/instructeur/dossiers/_envoyer_dossier_block.html.haml_spec.rb
index efe50d61d..7b690e803 100644
--- a/spec/views/instructeur/dossiers/_envoyer_dossier_block.html.haml_spec.rb
+++ b/spec/views/instructeur/dossiers/_envoyer_dossier_block.html.haml_spec.rb
@@ -1,23 +1,23 @@
-describe 'gestionnaires/dossiers/envoyer_dossier_block.html.haml', type: :view do
+describe 'instructeurs/dossiers/envoyer_dossier_block.html.haml', type: :view do
let(:dossier) { create(:dossier) }
subject do
render(
- 'gestionnaires/dossiers/envoyer_dossier_block.html.haml',
+ 'instructeurs/dossiers/envoyer_dossier_block.html.haml',
dossier: dossier,
potential_recipients: potential_recipients
)
end
- context "there are other gestionnaires for the procedure" do
- let(:gestionnaire) { create(:gestionnaire, email: 'yop@totomail.fr') }
- let(:potential_recipients) { [gestionnaire] }
+ context "there are other instructeurs for the procedure" do
+ let(:instructeur) { create(:instructeur, email: 'yop@totomail.fr') }
+ let(:potential_recipients) { [instructeur] }
- it { is_expected.to have_css("select > option[value='#{gestionnaire.id}']") }
+ it { is_expected.to have_css("select > option[value='#{instructeur.id}']") }
it { is_expected.to have_css(".button.send") }
end
- context "there is no other gestionnaire for the procedure" do
+ context "there is no other instructeur for the procedure" do
let(:potential_recipients) { [] }
it { is_expected.not_to have_css("select") }
diff --git a/spec/views/instructeur/dossiers/_state_button_motivation.html.haml_spec.rb b/spec/views/instructeur/dossiers/_state_button_motivation.html.haml_spec.rb
index d2d10cb91..368cf13cc 100644
--- a/spec/views/instructeur/dossiers/_state_button_motivation.html.haml_spec.rb
+++ b/spec/views/instructeur/dossiers/_state_button_motivation.html.haml_spec.rb
@@ -1,9 +1,9 @@
-describe 'gestionnaires/dossiers/state_button_motivation.html.haml', type: :view do
+describe 'instructeurs/dossiers/state_button_motivation.html.haml', type: :view do
let(:dossier) { create(:dossier, :en_instruction) }
subject! do
render(
- 'gestionnaires/dossiers/state_button_motivation.html.haml',
+ 'instructeurs/dossiers/state_button_motivation.html.haml',
dossier: dossier,
popup_title: 'Accepter le dossier',
placeholder: 'Expliquez au demandeur pourquoi ce dossier est accepté (facultatif)',
diff --git a/spec/views/instructeur/dossiers/print.html.haml_spec.rb b/spec/views/instructeur/dossiers/print.html.haml_spec.rb
index 26bdc949e..2269693c5 100644
--- a/spec/views/instructeur/dossiers/print.html.haml_spec.rb
+++ b/spec/views/instructeur/dossiers/print.html.haml_spec.rb
@@ -1,13 +1,13 @@
-describe 'gestionnaires/dossiers/print.html.haml', type: :view do
+describe 'instructeurs/dossiers/print.html.haml', type: :view do
before { view.extend DossierHelper }
context "with a dossier" do
- let(:current_gestionnaire) { create(:gestionnaire) }
+ let(:current_instructeur) { create(:instructeur) }
let(:dossier) { create(:dossier, :en_instruction, :with_commentaires) }
before do
assign(:dossier, dossier)
- allow(view).to receive(:current_gestionnaire).and_return(current_gestionnaire)
+ allow(view).to receive(:current_instructeur).and_return(current_instructeur)
render
end
diff --git a/spec/views/instructeur/dossiers/show.html.haml_spec.rb b/spec/views/instructeur/dossiers/show.html.haml_spec.rb
index 556013df6..46b93b0b0 100644
--- a/spec/views/instructeur/dossiers/show.html.haml_spec.rb
+++ b/spec/views/instructeur/dossiers/show.html.haml_spec.rb
@@ -1,9 +1,9 @@
-describe 'gestionnaires/dossiers/show.html.haml', type: :view do
- let(:current_gestionnaire) { create(:gestionnaire) }
+describe 'instructeurs/dossiers/show.html.haml', type: :view do
+ let(:current_instructeur) { create(:instructeur) }
let(:dossier) { create(:dossier, :en_construction) }
before do
- sign_in current_gestionnaire
+ sign_in current_instructeur
assign(:dossier, dossier)
end
diff --git a/spec/views/instructeur/procedures/_download_dossiers.html.haml_spec.rb b/spec/views/instructeur/procedures/_download_dossiers.html.haml_spec.rb
index a47d3d089..886de7d3c 100644
--- a/spec/views/instructeur/procedures/_download_dossiers.html.haml_spec.rb
+++ b/spec/views/instructeur/procedures/_download_dossiers.html.haml_spec.rb
@@ -1,8 +1,8 @@
-describe 'gestionnaires/procedures/_download_dossiers.html.haml', type: :view do
- let(:current_gestionnaire) { create(:gestionnaire) }
+describe 'instructeurs/procedures/_download_dossiers.html.haml', type: :view do
+ let(:current_instructeur) { create(:instructeur) }
let(:procedure) { create(:procedure) }
- subject { render 'gestionnaires/procedures/download_dossiers.html.haml', procedure: procedure }
+ subject { render 'instructeurs/procedures/download_dossiers.html.haml', procedure: procedure }
context "when procedure has 0 dossier" do
it { is_expected.not_to include("Télécharger tous les dossiers") }
diff --git a/spec/views/instructeur/shared/avis/list.html.haml_spec.rb b/spec/views/instructeur/shared/avis/list.html.haml_spec.rb
index d8abdcbe8..155acba31 100644
--- a/spec/views/instructeur/shared/avis/list.html.haml_spec.rb
+++ b/spec/views/instructeur/shared/avis/list.html.haml_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper'
-describe 'gestionnaires/shared/avis/_list.html.haml', type: :view do
+describe 'instructeurs/shared/avis/_list.html.haml', type: :view do
before { view.extend DossierHelper }
- subject { render 'gestionnaires/shared/avis/list.html.haml', avis: avis, avis_seen_at: seen_at, current_gestionnaire: gestionnaire }
+ subject { render 'instructeurs/shared/avis/list.html.haml', avis: avis, avis_seen_at: seen_at, current_instructeur: instructeur }
- let(:gestionnaire) { create(:gestionnaire) }
- let(:avis) { [create(:avis, claimant: gestionnaire)] }
+ let(:instructeur) { create(:instructeur) }
+ let(:avis) { [create(:avis, claimant: instructeur)] }
let(:seen_at) { avis.first.created_at + 1.hour }
it { is_expected.to have_text(avis.first.introduction) }
@@ -19,7 +19,7 @@ describe 'gestionnaires/shared/avis/_list.html.haml', type: :view do
end
context 'with an answer' do
- let(:avis) { [create(:avis, :with_answer, claimant: gestionnaire)] }
+ let(:avis) { [create(:avis, :with_answer, claimant: instructeur)] }
it 'renders the answer formatted with newlines' do
expect(subject).to include(simple_format(avis.first.answer))
diff --git a/spec/views/instructeur_mailer/send_notifications.html.haml_spec.rb b/spec/views/instructeur_mailer/send_notifications.html.haml_spec.rb
index df3fbbecc..0c8be4c27 100644
--- a/spec/views/instructeur_mailer/send_notifications.html.haml_spec.rb
+++ b/spec/views/instructeur_mailer/send_notifications.html.haml_spec.rb
@@ -1,7 +1,7 @@
require 'rails_helper'
-describe 'gestionnaire_mailer/send_notifications.html.haml', type: :view do
- let(:gestionnaire) { create(:gestionnaire) }
+describe 'instructeur_mailer/send_notifications.html.haml', type: :view do
+ let(:instructeur) { create(:instructeur) }
before do
assign(:data, data)
diff --git a/spec/views/layouts/_navbar_spec.rb b/spec/views/layouts/_navbar_spec.rb
index 448456d4f..99a108dd3 100644
--- a/spec/views/layouts/_navbar_spec.rb
+++ b/spec/views/layouts/_navbar_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'layouts/_navbar.html.haml', type: :view do
let(:administrateur) { create(:administrateur) }
- let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
+ let(:instructeur) { create(:instructeur, administrateurs: [administrateur]) }
let!(:procedure) { create(:procedure, administrateur: administrateur) }
@@ -27,10 +27,10 @@ describe 'layouts/_navbar.html.haml', type: :view do
it { is_expected.to match(/Déconnexion/) }
end
- context 'when gestionnaire is connected' do
+ context 'when instructeur is connected' do
before do
- @request.env["devise.mapping"] = Devise.mappings[:gestionnaire]
- @current_user = gestionnaire
+ @request.env["devise.mapping"] = Devise.mappings[:instructeur]
+ @current_user = instructeur
sign_in @current_user
render
end
diff --git a/spec/views/layouts/_new_header_spec.rb b/spec/views/layouts/_new_header_spec.rb
index 48a2b5b5a..90a6c32ca 100644
--- a/spec/views/layouts/_new_header_spec.rb
+++ b/spec/views/layouts/_new_header_spec.rb
@@ -45,11 +45,11 @@ describe 'layouts/_new_header.html.haml', type: :view do
end
end
- context 'when rendering for gestionnaire' do
- let(:user) { create(:gestionnaire) }
- let(:profile) { :gestionnaire }
+ context 'when rendering for instructeur' do
+ let(:user) { create(:instructeur) }
+ let(:profile) { :instructeur }
- it { is_expected.to have_css("a.header-logo[href=\"#{gestionnaire_procedures_path}\"]") }
+ it { is_expected.to have_css("a.header-logo[href=\"#{instructeur_procedures_path}\"]") }
it 'displays the Help dropdown menu' do
expect(subject).to have_css(".help-dropdown")
diff --git a/spec/views/shared/dossiers/_champs.html.haml_spec.rb b/spec/views/shared/dossiers/_champs.html.haml_spec.rb
index 58d6c5690..81566f02a 100644
--- a/spec/views/shared/dossiers/_champs.html.haml_spec.rb
+++ b/spec/views/shared/dossiers/_champs.html.haml_spec.rb
@@ -1,18 +1,18 @@
describe 'shared/dossiers/champs.html.haml', type: :view do
- let(:gestionnaire) { create(:gestionnaire) }
+ let(:instructeur) { create(:instructeur) }
let(:demande_seen_at) { nil }
before do
view.extend DossierHelper
view.extend DossierLinkHelper
- allow(view).to receive(:current_gestionnaire).and_return(gestionnaire)
+ allow(view).to receive(:current_instructeur).and_return(instructeur)
end
subject { render 'shared/dossiers/champs.html.haml', champs: champs, demande_seen_at: demande_seen_at, profile: nil }
context "there are some champs" do
let(:dossier) { create(:dossier) }
- let(:avis) { create :avis, dossier: dossier, gestionnaire: gestionnaire }
+ let(:avis) { create :avis, dossier: dossier, instructeur: instructeur }
let(:champ1) { create(:champ, :checkbox, value: "on") }
let(:champ2) { create(:champ, :header_section, value: "Section") }
let(:champ3) { create(:champ, :explication, value: "mazette") }
diff --git a/spec/views/shared/dossiers/_demande.html.haml_spec.rb b/spec/views/shared/dossiers/_demande.html.haml_spec.rb
index dbb4dcba7..b3d1defed 100644
--- a/spec/views/shared/dossiers/_demande.html.haml_spec.rb
+++ b/spec/views/shared/dossiers/_demande.html.haml_spec.rb
@@ -1,12 +1,12 @@
describe 'shared/dossiers/demande.html.haml', type: :view do
- let(:current_gestionnaire) { create(:gestionnaire) }
+ let(:current_instructeur) { create(:instructeur) }
let(:individual) { nil }
let(:etablissement) { nil }
let(:procedure) { create(:procedure, :published) }
let(:dossier) { create(:dossier, :en_construction, procedure: procedure, etablissement: etablissement, individual: individual) }
before do
- sign_in current_gestionnaire
+ sign_in current_instructeur
end
subject! { render 'shared/dossiers/demande.html.haml', dossier: dossier, demande_seen_at: nil, profile: 'usager' }