Use shorter responses and configuration for specs

By simplyfing the responses the configuration for specs can be simpler too.

We're also using more generic terms instead of the ones used in Madrid's
Census API.

Co-Authored-By: Javi Martín <javim@elretirao.net>
This commit is contained in:
Senén Rodero Rodríguez
2020-10-27 23:45:50 +01:00
committed by Javi Martín
parent 3ed4bdaff8
commit dd0f56f85f
4 changed files with 47 additions and 76 deletions

View File

@@ -45,6 +45,9 @@ describe CensusCaller do
end
describe "RemoteCensusApi", :remote_census do
let(:valid_body) { { response: { data: { document_number: "12345678" }}} }
let(:invalid_body) { { response: { data: {}}} }
it "returns remote census api response when it's available and response is valid" do
remote_census_api_response = RemoteCensusApi::Response.new(valid_body)
allow_any_instance_of(RemoteCensusApi).to receive(:call).and_return(remote_census_api_response)