feat(dossier/projection): supports pending_correction?

This commit is contained in:
Colin Darie 2023-03-27 16:23:11 +02:00
parent 7a9917fb32
commit 538e24fa7e
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
2 changed files with 45 additions and 2 deletions

View file

@ -248,6 +248,29 @@ describe DossierProjectionService do
it { is_expected.to eq("") }
end
end
context 'for dossier reolutions table' do
let(:table) { 'dossier_resolutions' }
let(:column) { 'resolved_at' }
let(:dossier) { create(:dossier, :en_construction) }
subject { described_class.project(dossiers_ids, fields)[0] }
context "when dossier has pending correction" do
before { create(:dossier_resolution, dossier:) }
it { expect(subject.pending_correction?).to be(true) }
end
context "when dossier has a resolved correction" do
before { create(:dossier_resolution, :resolved, dossier:) }
it { expect(subject.pending_correction?).to eq(false) }
end
context "when dossier has no correction at all" do
it { expect(subject.pending_correction?).to eq(false) }
end
end
end
end
end