From b0af503630171d45771900b007a24143a18fad13 Mon Sep 17 00:00:00 2001 From: ro3t Date: Thu, 12 Oct 2023 13:51:26 +0200 Subject: [PATCH] =?UTF-8?q?Falsches=20Stubing=20f=C3=BCr=20Geocodr-Anfrage?= =?UTF-8?q?n=20berichtigt=20(#317)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/controllers/citysdk/requests_controller_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/controllers/citysdk/requests_controller_test.rb b/test/controllers/citysdk/requests_controller_test.rb index 4eba36f0..ef45d239 100644 --- a/test/controllers/citysdk/requests_controller_test.rb +++ b/test/controllers/citysdk/requests_controller_test.rb @@ -234,7 +234,7 @@ class RequestsControllerTest < ActionDispatch::IntegrationTest end test 'create with frontend api-key but geocodr returns forbidden' do - URI.stub :open, OpenURI::HTTPError.new(403, 'FORBIDDEN') do + OpenURI.stub :open_uri, ->(_a, _b) { raise OpenURI::HTTPError.new(403, 'FORBIDDEN') } do post "/citysdk/requests.xml?api_key=#{api_key_frontend}", params: valid_create_params doc = Nokogiri::XML(response.parsed_body) service_request_id = doc.xpath('/service_requests/request/service_request_id') @@ -251,7 +251,7 @@ class RequestsControllerTest < ActionDispatch::IntegrationTest end test 'create with frontend api-key but geocodr is not available' do - URI.stub :open, OpenURI::HTTPError.new(500, 'INTERNAL SERVER ERROR') do + OpenURI.stub :open_uri, ->(_a, _b) { raise OpenURI::HTTPError.new(500, 'INTERNAL SERVER ERROR') } do post "/citysdk/requests.xml?api_key=#{api_key_frontend}", params: valid_create_params doc = Nokogiri::XML(response.parsed_body) service_request_id = doc.xpath('/service_requests/request/service_request_id') @@ -350,7 +350,7 @@ class RequestsControllerTest < ActionDispatch::IntegrationTest test 'update attribute address_string but geocodr is not available' do new_value = 'Holbeinplatz 14, 18069 Rostock' - URI.stub :open, OpenURI::HTTPError.new(500, 'INTERNAL SERVER ERROR') do + OpenURI.stub :open_uri, ->(_a, _b) { raise OpenURI::HTTPError.new(500, 'INTERNAL SERVER ERROR') } do put "/citysdk/requests/#{issue(:one).id}.xml?api_key=#{api_key_ppc}", params: { address_string: new_value } doc = Nokogiri::XML(response.parsed_body) assert_error_messages doc, '422', 'Gültigkeitsprüfung ist fehlgeschlagen'