This is why you need to add a COUNT(DISTINCT dossiers.id) to make it work
This commit is contained in:
parent
594cda3ee3
commit
52c8b60419
1 changed files with 14 additions and 1 deletions
|
@ -570,7 +570,8 @@ describe Instructeur, type: :model do
|
|||
|
||||
describe "#dossiers_count_summary" do
|
||||
let(:instructeur_2) { create(:instructeur) }
|
||||
let(:procedure) { create(:procedure, instructeurs: [instructeur_2]) }
|
||||
let(:instructeur_3) { create(:instructeur) }
|
||||
let(:procedure) { create(:procedure, instructeurs: [instructeur_2, instructeur_3]) }
|
||||
let(:gi_1) { procedure.groupe_instructeurs.first }
|
||||
let(:gi_2) { procedure.groupe_instructeurs.create(label: '2') }
|
||||
let(:gi_3) { procedure.groupe_instructeurs.create(label: '3') }
|
||||
|
@ -635,6 +636,18 @@ describe Instructeur, type: :model do
|
|||
it { expect(subject['tous']).to eq(1) }
|
||||
it { expect(subject['archives']).to eq(0) }
|
||||
|
||||
context 'and another one follows the same dossier' do
|
||||
before do
|
||||
instructeur_3.followed_dossiers << new_followed_dossier
|
||||
end
|
||||
|
||||
it { expect(subject['a_suivre']).to eq(0) }
|
||||
it { expect(subject['suivis']).to eq(1) }
|
||||
it { expect(subject['traites']).to eq(0) }
|
||||
it { expect(subject['tous']).to eq(1) }
|
||||
it { expect(subject['archives']).to eq(0) }
|
||||
end
|
||||
|
||||
context 'and dossier with a follower on each of the others groups' do
|
||||
let!(:new_follow_dossier_on_gi_2) { create(:dossier, :en_instruction, groupe_instructeur: gi_2) }
|
||||
let!(:new_follow_dossier_on_gi_3) { create(:dossier, :en_instruction, groupe_instructeur: gi_3) }
|
||||
|
|
Loading…
Add table
Reference in a new issue