diff --git a/app/jobs/generate_attributive_decision_job.rb b/app/jobs/generate_attributive_decision_job.rb index 2779e688e..f36276a09 100644 --- a/app/jobs/generate_attributive_decision_job.rb +++ b/app/jobs/generate_attributive_decision_job.rb @@ -15,7 +15,7 @@ class GenerateAttributiveDecisionJob < ApplicationJob end def perform(schooling) - Sync::StudentJob.new.perform(schooling) if schooling.student.missing_address? + Sync::StudentJob.new.perform(schooling) Schooling.transaction do generate_document(schooling) diff --git a/spec/jobs/generate_attributive_decision_job_spec.rb b/spec/jobs/generate_attributive_decision_job_spec.rb index 6ec735311..e22a9e065 100644 --- a/spec/jobs/generate_attributive_decision_job_spec.rb +++ b/spec/jobs/generate_attributive_decision_job_spec.rb @@ -37,12 +37,17 @@ end context "when the student already has an address" do - before { student.update!(address_line1: "some address") } - - it "does not call the api" do + before do + student.update!(address_line1: "some address") job.perform_now + end + + it "call the api" do + expect(a_request(:get, /#{ENV.fetch('APLYPRO_SYGNE_URL')}/)).to have_been_made + end - expect(a_request(:get, /#{ENV.fetch('APLYPRO_SYGNE_URL')}/)).not_to have_been_made + it "update the address" do + expect(student.address_line1).not_to eq "some address" end end