diff --git a/test/lookup_test.rb b/test/lookup_test.rb index 416662ac21866c68ba499f8feb6c1814b05b7f4c..3fb9373b1e7b7fe0efa04ba32d853adf24f2d9cc 100644 --- a/test/lookup_test.rb +++ b/test/lookup_test.rb @@ -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| diff --git a/test/services_test.rb b/test/services_test.rb index 2f537b6f105778cf5c3c25d51933982e0d1a189f..3e2d596bfae75f8eae24b0a3fc340528b1338e03 100644 --- a/test/services_test.rb +++ b/test/services_test.rb @@ -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