Skip to content

Commit

Permalink
Use existing google_request_denied.txt mock
Browse files Browse the repository at this point in the history
Don't suppress any errors, please.
  • Loading branch information
AlexWayfer committed Feb 21, 2018
1 parent 4bd17e2 commit 7f4626f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions lib/timezone/lookup/geonames.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions lib/timezone/lookup/google.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ def lookup(lat, long)
end

data['timeZoneId']
rescue StandardError => e
raise(Timezone::Error::Google, e.message)
end

private
Expand Down
4 changes: 3 additions & 1 deletion test/timezone/lookup/test_google.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7f4626f

Please sign in to comment.