Skip to content

Commit

Permalink
Mettre à jour les addresses postales retournées par les APIs (#1241)
Browse files Browse the repository at this point in the history
  • Loading branch information
tnicolas1 authored Nov 26, 2024
1 parent 2a124f6 commit db3b759
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/jobs/generate_attributive_decision_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 9 additions & 4 deletions spec/jobs/generate_attributive_decision_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit db3b759

Please sign in to comment.