Skip to content
Snippets Groups Projects
Commit 6e4a3e98 authored by Alex Reisner's avatar Alex Reisner
Browse files

Move test from ServicesTest to LookupTest.

parent 55b90f70
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,19 @@ class LookupTest < Test::Unit::TestCase
end
end
def test_query_url_contains_values_in_params_hash
Geocoder::Lookup.all_services_except_test.each do |l|
next if l == :freegeoip # does not use query string
set_api_key!(l)
url = Geocoder::Lookup.get(l).send(:query_url, Geocoder::Query.new(
"test", :params => {:one_in_the_hand => "two in the bush"}
))
# should be "+"s for all lookups except Yahoo
assert_match /one_in_the_hand=two(%20|\+)in(%20|\+)the(%20|\+)bush/, url,
"Lookup #{l} does not appear to support arbitrary params in URL"
end
end
def test_raises_exception_on_invalid_key
Geocoder.configure(:always_raise => [Geocoder::InvalidApiKey])
#Geocoder::Lookup.all_services_except_test.each do |l|
......
......@@ -3,20 +3,6 @@ require 'test_helper'
class ServicesTest < Test::Unit::TestCase
def test_query_url_contains_values_in_params_hash
Geocoder::Lookup.all_services_except_test.each do |l|
next if l == :freegeoip # does not use query string
set_api_key!(l)
url = Geocoder::Lookup.get(l).send(:query_url, Geocoder::Query.new(
"test", :params => {:one_in_the_hand => "two in the bush"}
))
# should be "+"s for all lookups except Yahoo
assert_match /one_in_the_hand=two(%20|\+)in(%20|\+)the(%20|\+)bush/, url,
"Lookup #{l} does not appear to support arbitrary params in URL"
end
end
# --- Google ---
def test_google_result_components
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment