[Fix #319] Include archived dossiers in the export

This commit is contained in:
gregoirenovel 2017-05-26 18:14:00 +02:00
parent 5253f07b69
commit 4655707eb5
2 changed files with 3 additions and 1 deletions

View file

@ -200,7 +200,7 @@ class Dossier < ActiveRecord::Base
scope :archived, -> { where(archived: true) }
scope :not_archived, -> { where(archived: false) }
scope :downloadable, -> { all_state }
scope :downloadable, -> { not_brouillon.order_by_updated_at("ASC") }
def cerfa_available?
procedure.cerfa_flag? && cerfa.size != 0

View file

@ -911,11 +911,13 @@ describe Dossier do
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: :draft) }
let!(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure, state: :initiated) }
let!(:dossier3) { create(:dossier, :with_entreprise, procedure: procedure, state: :received) }
let!(:dossier4) { create(:dossier, :with_entreprise, procedure: procedure, state: :received, archived: true) }
subject { procedure.dossiers.downloadable }
it { is_expected.not_to include(dossier)}
it { is_expected.to include(dossier2)}
it { is_expected.to include(dossier3)}
it { is_expected.to include(dossier4)}
end
end