bug(export): la creation d'une archive avec un filtre different devrait etre effective, ce n'est pas le cas
This commit is contained in:
parent
cde1aebe5e
commit
cf51be85e0
1 changed files with 22 additions and 0 deletions
|
@ -66,6 +66,28 @@ RSpec.describe Export, type: :model do
|
|||
end
|
||||
end
|
||||
|
||||
describe '.find_or_create_export' do
|
||||
let!(:procedure) { create(:procedure) }
|
||||
let!(:gi_1) { create(:groupe_instructeur, procedure: procedure, instructeurs: [create(:instructeur)]) }
|
||||
let!(:pp) { gi_1.instructeurs.first.procedure_presentation_and_errors_for_procedure_id(procedure.id).first }
|
||||
before { pp.add_filter('tous', 'self/created_at', '10/12/2021') }
|
||||
|
||||
context 'with procedure_presentation having different filters' do
|
||||
it 'works once' do
|
||||
expect { Export.find_or_create_export(:zip, [gi_1], time_span_type: Export.time_span_types.fetch(:everything), statut: Export.statuts.fetch(:tous), procedure_presentation: pp) }
|
||||
.to change { Export.count }.by(1)
|
||||
end
|
||||
|
||||
it 'works once, changes procedure_presentation, recreate a new' do
|
||||
expect { Export.find_or_create_export(:zip, [gi_1], time_span_type: Export.time_span_types.fetch(:everything), statut: Export.statuts.fetch(:tous), procedure_presentation: pp) }
|
||||
.to change { Export.count }.by(1)
|
||||
pp.add_filter('tous', 'self/updated_at', '10/12/2021')
|
||||
expect { Export.find_or_create_export(:zip, [gi_1], time_span_type: Export.time_span_types.fetch(:everything), statut: Export.statuts.fetch(:tous), procedure_presentation: pp) }
|
||||
.to change { Export.count }.by(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '.dossiers_for_export' do
|
||||
let!(:procedure) { create(:procedure, :published, :with_instructeur) }
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue