dossier_facade: remplace followers by an equivalent implementation

This commit is contained in:
Pierre de La Morinerie 2018-07-11 14:28:54 +00:00 committed by gregoirenovel
parent fab2439f31
commit dee4acd802
2 changed files with 9 additions and 1 deletions

View file

@ -54,6 +54,6 @@ class DossierFacades
end
def followers
Gestionnaire.joins(:follows).where("follows.dossier_id=#{@dossier.id}")
@dossier.followers_gestionnaires
end
end

View file

@ -189,6 +189,14 @@ describe Dossier do
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) }
describe "followers_gestionnaires" do
let(:non_following_gestionnaire) { create(:gestionnaire) }
subject { dossier.followers_gestionnaires }
it { expect(subject).to eq [gestionnaire] }
it { expect(subject).not_to include(non_following_gestionnaire) }
end
describe '#export_headers' do
subject { dossier.export_headers }