Update FailedCensusCall with new fields

This commit is contained in:
taitus
2019-04-25 17:01:30 +02:00
committed by Javi Martín
parent ff5f7ad401
commit cc49587fe4
2 changed files with 25 additions and 0 deletions

View File

@@ -53,6 +53,8 @@ class Officing::Residence
user: user,
document_number: document_number,
document_type: document_type,
date_of_birth: date_of_birth,
postal_code: postal_code,
year_of_birth: year_of_birth,
poll_officer: officer
)

View File

@@ -109,6 +109,27 @@ describe Officing::Residence do
end
end
it "stores failed census calls and set postal_code attribute" do
Setting["remote_census.request.date_of_birth"] = ""
residence = build(:officing_residence,
:invalid,
document_number: "12345678Z",
postal_code: "00001")
residence.save
expect(FailedCensusCall.count).to eq(1)
expect(FailedCensusCall.first).to have_attributes(
user_id: residence.user.id,
poll_officer_id: residence.officer.id,
document_number: "12345678Z",
document_type: "1",
date_of_birth: nil,
postal_code: "00001",
year_of_birth: Time.current.year
)
end
end
describe "allowed age" do
@@ -198,6 +219,8 @@ describe Officing::Residence do
poll_officer_id: residence.officer.id,
document_number: "12345678Z",
document_type: "1",
date_of_birth: nil,
postal_code: nil,
year_of_birth: Time.current.year
)
end