Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use existing google_request_denied.txt mock #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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