Verification::Residence allow to use new RemoteCensusAPI
Verification::Residence allow send params :date_of_birth and :postal_code to CensusCaller 'call' method.
This commit is contained in:
@@ -71,7 +71,7 @@ class Verification::Residence
|
||||
private
|
||||
|
||||
def retrieve_census_data
|
||||
@census_data = CensusCaller.new.call(document_type, document_number)
|
||||
@census_data = CensusCaller.new.call(document_type, document_number, date_of_birth, postal_code)
|
||||
end
|
||||
|
||||
def residency_valid?
|
||||
|
||||
@@ -21,6 +21,31 @@ describe "Residence" do
|
||||
expect(page).to have_content "Residence verified"
|
||||
end
|
||||
|
||||
scenario "Verify resident throught RemoteCensusApi" do
|
||||
Setting["feature.remote_census"] = true
|
||||
|
||||
access_user_data = "get_habita_datos_response.get_habita_datos_return.datos_habitante.item"
|
||||
access_residence_data = "get_habita_datos_response.get_habita_datos_return.datos_vivienda.item"
|
||||
Setting["remote_census.response.date_of_birth"] = "#{access_user_data}.fecha_nacimiento_string"
|
||||
Setting["remote_census.response.postal_code"] = "#{access_residence_data}.codigo_postal"
|
||||
Setting["remote_census.response.valid"] = access_user_data
|
||||
user = create(:user)
|
||||
login_as(user)
|
||||
|
||||
visit account_path
|
||||
click_link "Verify my account"
|
||||
|
||||
fill_in "residence_document_number", with: "12345678Z"
|
||||
select "DNI", from: "residence_document_type"
|
||||
select_date "31-December-1980", from: "residence_date_of_birth"
|
||||
fill_in "residence_postal_code", with: "28013"
|
||||
check "residence_terms_of_service"
|
||||
click_button "Verify residence"
|
||||
|
||||
expect(page).to have_content "Residence verified"
|
||||
Setting["feature.remote_census"] = nil
|
||||
end
|
||||
|
||||
scenario "Residence form use min age to participate" do
|
||||
min_age = (Setting["min_age_to_participate"] = 16).to_i
|
||||
underage = min_age - 1
|
||||
|
||||
Reference in New Issue
Block a user