Add Dossier#text_summary

This commit is contained in:
gregoirenovel 2017-04-18 17:31:01 +02:00
parent c0fd56ea8e
commit f5c5ad532d
2 changed files with 42 additions and 0 deletions

View file

@ -809,6 +809,26 @@ describe Dossier do
end
end
describe "#text_summary" do
let(:procedure) { create(:procedure, libelle: "Démarche", organisation: "Organisation") }
context 'when the dossier has been initiated' do
let(:dossier) { create :dossier, procedure: procedure, state: 'initiated', initiated_at: "31/12/2010".to_date }
subject { dossier.text_summary }
it { is_expected.to eq("Dossier déposé le 31/12/2010, sur la démarche Démarche, gérée par l'organisme Organisation") }
end
context 'when the dossier has not been initiated' do
let(:dossier) { create :dossier, procedure: procedure, state: 'draft' }
subject { dossier.text_summary }
it { is_expected.to eq("Dossier en brouillon répondant à la démarche Démarche, gérée par l'organisme Organisation") }
end
end
describe '#update_state_dates' do
let(:state) { 'draft' }
let(:dossier) { create(:dossier, state: state) }