Residence Verification now fills up the date of birth and genre

This commit is contained in:
kikito
2016-04-12 13:38:39 +02:00
parent 6229097032
commit 2c51115d6d
2 changed files with 16 additions and 1 deletions

View File

@@ -31,6 +31,8 @@ class Verification::Residence
user.update(document_number: document_number,
document_type: document_type,
geozone: self.geozone,
date_of_birth: date_of_birth.to_datetime,
genre: genre,
residence_verified_at: Time.now)
end
@@ -75,6 +77,15 @@ class Verification::Residence
@census_api_response.district_code
end
def genre
case @census_api_response.genre
when "Varón"
"male"
when "Mujer"
"female"
end
end
private
def call_census_api

View File

@@ -85,7 +85,7 @@ describe Verification::Residence do
describe "save" do
it "should store document number, document type, and geozone" do
it "should store document number, document type, geozone, date of birth and genre" do
user = create(:user)
residence.user = user
residence.save
@@ -93,6 +93,10 @@ describe Verification::Residence do
user.reload
expect(user.document_number).to eq('12345678Z')
expect(user.document_type).to eq("1")
expect(user.date_of_birth.year).to eq(1980)
expect(user.date_of_birth.month).to eq(12)
expect(user.date_of_birth.day).to eq(31)
expect(user.genre).to eq('male')
expect(user.geozone).to eq(geozone)
end