Allow to Signature works with CustomCensusAPI

- Send new fields to CensusCaller call method to
  allow use on CustomCensusAPI
This commit is contained in:
taitus
2019-05-14 11:47:55 +02:00
committed by Javi Martín
parent 0bf88abcf1
commit 626d2b3c2b
4 changed files with 153 additions and 1 deletions

View File

@@ -76,6 +76,62 @@ describe "Signature sheets" do
end
context "Create throught all required_fields_to_verify of custom census api" do
before do
Setting["feature.remote_census"] = true
Setting["remote_census.request.date_of_birth"] = "some.value"
Setting["remote_census.request.postal_code"] = "some.value"
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
end
after do
Setting["feature.remote_census"] = nil
Setting["remote_census.request.date_of_birth"] = nil
Setting["remote_census.request.postal_code"] = nil
end
scenario "Proposal" do
proposal = create(:proposal)
visit new_admin_signature_sheet_path
select "Citizen proposal", from: "signature_sheet_signable_type"
fill_in "signature_sheet_signable_id", with: proposal.id
fill_in "signature_sheet_required_fields_to_verify", with: "12345678Z, 31/12/1980, 28013; 99999999Z, 31/12/1980, 28013"
click_button "Create signature sheet"
expect(page).to have_content "Signature sheet created successfully"
visit proposal_path(proposal)
expect(page).to have_content "1 support"
end
scenario "Budget Investment" do
investment = create(:budget_investment)
budget = investment.budget
budget.update(phase: "selecting")
visit new_admin_signature_sheet_path
select "Investment", from: "signature_sheet_signable_type"
fill_in "signature_sheet_signable_id", with: investment.id
fill_in "signature_sheet_required_fields_to_verify", with: "12345678Z, 31/12/1980, 28013; 99999999Z, 31/12/1980, 28013"
click_button "Create signature sheet"
expect(page).to have_content "Signature sheet created successfully"
visit budget_investment_path(budget, investment)
expect(page).to have_content "1 support"
end
end
scenario "Errors on create" do
visit new_admin_signature_sheet_path