From 6b88b3a3c1fa5f11e8cddf73eb71a16d148ff4b5 Mon Sep 17 00:00:00 2001 From: Alex Reisner <alex@alexreisner.com> Date: Thu, 13 Mar 2014 16:22:32 -0400 Subject: [PATCH] Move test from base to smarty_streets. --- test/unit/lookup_test.rb | 16 ---------------- test/unit/lookups/smarty_streets_test.rb | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/test/unit/lookup_test.rb b/test/unit/lookup_test.rb index 4d1ad3d0..83561537 100644 --- a/test/unit/lookup_test.rb +++ b/test/unit/lookup_test.rb @@ -56,22 +56,6 @@ class LookupTest < GeocoderTestCase end end - def test_raises_exception_on_error_http_status - error_statuses = { - '400' => Geocoder::InvalidRequest, - '401' => Geocoder::RequestDenied, - '402' => Geocoder::OverQueryLimitError - } - Geocoder.configure(always_raise: error_statuses.values) - error_statuses.each do |code, err| - assert_raises err do - lookup = Geocoder::Lookup.get(:smarty_streets) - response = MockHttpResponse.new(code: code.to_i) - lookup.send(:check_response_for_errors!, response) - end - end - end - def test_raises_exception_on_invalid_key Geocoder.configure(:always_raise => [Geocoder::InvalidApiKey]) #Geocoder::Lookup.all_services_except_test.each do |l| diff --git a/test/unit/lookups/smarty_streets_test.rb b/test/unit/lookups/smarty_streets_test.rb index f797f21f..fe666d1d 100644 --- a/test/unit/lookups/smarty_streets_test.rb +++ b/test/unit/lookups/smarty_streets_test.rb @@ -51,4 +51,19 @@ class SmartyStreetsTest < GeocoderTestCase assert_equal 0, results.length end + def test_raises_exception_on_error_http_status + error_statuses = { + '400' => Geocoder::InvalidRequest, + '401' => Geocoder::RequestDenied, + '402' => Geocoder::OverQueryLimitError + } + Geocoder.configure(always_raise: error_statuses.values) + lookup = Geocoder::Lookup.get(:smarty_streets) + error_statuses.each do |code, err| + assert_raises err do + response = MockHttpResponse.new(code: code.to_i) + lookup.send(:check_response_for_errors!, response) + end + end + end end -- GitLab