From 6e4a3e982192ab0763e1fde5465182258f88f50e Mon Sep 17 00:00:00 2001 From: Alex Reisner <alex@alexreisner.com> Date: Sat, 22 Dec 2012 19:15:28 -0500 Subject: [PATCH] Move test from ServicesTest to LookupTest. --- test/lookup_test.rb | 13 +++++++++++++ test/services_test.rb | 14 -------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/test/lookup_test.rb b/test/lookup_test.rb index 416662ac..3fb9373b 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 2f537b6f..3e2d596b 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 -- GitLab