From 7f4626f7323bbfe5ed4f1675e38b87a870886031 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Thu, 9 Nov 2017 16:33:57 +0300 Subject: [PATCH] Use existing `google_request_denied.txt` mock Don't suppress any errors, please. --- lib/timezone/lookup/geonames.rb | 2 -- lib/timezone/lookup/google.rb | 2 -- test/timezone/lookup/test_google.rb | 4 +++- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/timezone/lookup/geonames.rb b/lib/timezone/lookup/geonames.rb index ccd6ae0e..49883f76 100644 --- a/lib/timezone/lookup/geonames.rb +++ b/lib/timezone/lookup/geonames.rb @@ -41,8 +41,6 @@ def lookup(lat, long) return if NO_TIMEZONE_INFORMATION == data['status']['value'] raise(Timezone::Error::GeoNames, data['status']['message']) - rescue StandardError => e - raise(Timezone::Error::GeoNames, e.message) end private diff --git a/lib/timezone/lookup/google.rb b/lib/timezone/lookup/google.rb index 56466399..cd2d6238 100644 --- a/lib/timezone/lookup/google.rb +++ b/lib/timezone/lookup/google.rb @@ -44,8 +44,6 @@ def lookup(lat, long) end data['timeZoneId'] - rescue StandardError => e - raise(Timezone::Error::Google, e.message) end private diff --git a/test/timezone/lookup/test_google.rb b/test/timezone/lookup/test_google.rb index b8e5db34..fdbb56a8 100644 --- a/test/timezone/lookup/test_google.rb +++ b/test/timezone/lookup/test_google.rb @@ -39,7 +39,9 @@ def test_google_using_lat_long_coordinates end def test_google_request_denied_read_lat_long_coordinates - mine = lookup(nil) + mine = lookup( + File.open(mock_path + '/google_request_denied.txt').read + ) assert_raises Timezone::Error::Google, 'The provided API key is invalid.' do mine.lookup(*coordinates)