Merge pull request #1075 from sgmap/fix_1053_declaratoire

[fix #1053] An Administrateur can choose the final dossier states
This commit is contained in:
LeSim 2017-12-11 16:59:01 +01:00 committed by GitHub
commit b2c9d8f227
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -1,10 +1,10 @@
class AutoReceiveDossiersForProcedureJob < ApplicationJob
queue_as :cron
def perform(procedure_id)
def perform(procedure_id, state)
procedure = Procedure.find_by(id: procedure_id)
if procedure
procedure.dossiers.state_nouveaux.update_all(state: "received", received_at: Time.now)
procedure.dossiers.state_nouveaux.update_all(state: state, received_at: Time.now)
end
end
end

View file

@ -7,7 +7,7 @@ RSpec.describe AutoReceiveDossiersForProcedureJob, type: :job do
before { Timecop.freeze(date) }
after { Timecop.return }
subject { AutoReceiveDossiersForProcedureJob.new.perform(procedure_id) }
subject { AutoReceiveDossiersForProcedureJob.new.perform(procedure_id, 'received') }
context "with some dossiers" do
let(:nouveau_dossier1) { create(:dossier, :initiated) }