]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/geocoder_controller_test.rb
Add tests for quad tiles
[rails.git] / test / controllers / geocoder_controller_test.rb
index ecddf96aaaa08fe399dcf385b18e5db86e0a265e..0d062cf4237abea2da71bb1f75502044cd746eff 100644 (file)
@@ -1,5 +1,3 @@
-# coding: utf-8
-
 require "test_helper"
 require "geocoder_controller"
 
@@ -15,10 +13,6 @@ class GeocoderControllerTest < ActionController::TestCase
       { :path => "/geocoder/search_latlon", :method => :get },
       { :controller => "geocoder", :action => "search_latlon" }
     )
-    assert_routing(
-      { :path => "/geocoder/search_us_postcode", :method => :get },
-      { :controller => "geocoder", :action => "search_us_postcode" }
-    )
     assert_routing(
       { :path => "/geocoder/search_uk_postcode", :method => :get },
       { :controller => "geocoder", :action => "search_uk_postcode" }
@@ -253,7 +247,7 @@ class GeocoderControllerTest < ActionController::TestCase
     ].each do |code|
       post :search, :params => { :query => code }
       assert_response :success
-      assert_equal %w[us_postcode osm_nominatim], assigns(:sources)
+      assert_equal %w[osm_nominatim], assigns(:sources)
     end
   end
 
@@ -304,25 +298,6 @@ class GeocoderControllerTest < ActionController::TestCase
     results_check_error "Longitude 180.23 out of range"
   end
 
-  ##
-  # Test the US postcode search
-  def test_search_us_postcode
-    with_http_stubs "geocoder_us" do
-      get :search_us_postcode, :xhr => true,
-                               :params => { :query => "90210", :zoom => 10,
-                                            :minlon => -0.559, :minlat => 51.217,
-                                            :maxlon => 0.836, :maxlat => 51.766 }
-      results_check :prefix => "Beverly Hills, CA,", :name => "90210",
-                    :lat => 34.088808, :lon => -118.40612
-
-      get :search_us_postcode, :xhr => true,
-                               :params => { :query => "00000", :zoom => 10,
-                                            :minlon => -0.559, :minlat => 51.217,
-                                            :maxlon => 0.836, :maxlat => 51.766 }
-      results_check
-    end
-  end
-
   ##
   # Test the UK postcode search
   def test_search_uk_postcode
@@ -449,6 +424,12 @@ class GeocoderControllerTest < ActionController::TestCase
       results_check :name => "Dinant Link Road, Broxbourne, Hertfordshire, East of England, England, EN11 8HX, United Kingdom",
                     :lat => 51.7634883, :lon => -0.0088373,
                     :type => "way", :id => 3489841, :zoom => 17
+
+      get :search_osm_nominatim_reverse, :xhr => true,
+                                         :params => { :lat => 13.7709, :lon => 100.50507, :zoom => 19 }
+      results_check :name => "MM Steak&Grill, ถนนศรีอยุธยา, บางขุนพรหม, กรุงเทพมหานคร, เขตดุสิต, กรุงเทพมหานคร, 10300, ประเทศไทย",
+                    :lat => 13.7708691, :lon => 100.505073233221,
+                    :type => "way", :id => 542901374, :zoom => 19
     end
   end