diff --git a/app/models/instructeur.rb b/app/models/instructeur.rb index 8f72114cd..9c5d07a2b 100644 --- a/app/models/instructeur.rb +++ b/app/models/instructeur.rb @@ -11,8 +11,7 @@ # agent_connect_id :string # class Instructeur < ApplicationRecord - has_many :administrateurs_instructeurs - has_many :administrateurs, through: :administrateurs_instructeurs + has_and_belongs_to_many :administrateurs has_many :assign_to, dependent: :destroy has_many :groupe_instructeurs, through: :assign_to diff --git a/spec/models/instructeur_spec.rb b/spec/models/instructeur_spec.rb index bc0c87d94..b108cfe95 100644 --- a/spec/models/instructeur_spec.rb +++ b/spec/models/instructeur_spec.rb @@ -12,6 +12,10 @@ describe Instructeur, type: :model do procedure_3 end + describe 'associations' do + it { is_expected.to have_and_belong_to_many(:administrateurs) } + end + describe 'follow' do let(:dossier) { create :dossier } let(:already_followed_dossier) { create :dossier }