]> git.openstreetmap.org Git - rails.git/blobdiff - test/functional/geocoder_controller_test.rb
Add a paging control to the user blocks list
[rails.git] / test / functional / geocoder_controller_test.rb
index 3faadc7404aab06ec9fb202d3505bb7175d633a5..b678125d2e4af3bb80be94e0dfc973b713a305be 100644 (file)
@@ -1,18 +1,58 @@
 require File.dirname(__FILE__) + '/../test_helper'
 require 'geocoder_controller'
 
-# Re-raise errors caught by the controller.
-class GeocoderController; def rescue_action(e) raise e end; end
+class GeocoderControllerTest < ActionController::TestCase
+  ##
+  # test all routes which lead to this controller
+  def test_routes
+    assert_routing(
+      { :path => "/geocoder/search", :method => :post },
+      { :controller => "geocoder", :action => "search" }
+    )
+    assert_routing(
+      { :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" }
+    )
+    assert_routing(
+      { :path => "/geocoder/search_ca_postcode", :method => :get },
+      { :controller => "geocoder", :action => "search_ca_postcode" }
+    )
+    assert_routing(
+      { :path => "/geocoder/search_osm_namefinder", :method => :get },
+      { :controller => "geocoder", :action => "search_osm_namefinder" }
+    )
+    assert_routing(
+      { :path => "/geocoder/search_osm_nominatim", :method => :get },
+      { :controller => "geocoder", :action => "search_osm_nominatim" }
+    )
+    assert_routing(
+      { :path => "/geocoder/search_geonames", :method => :get },
+      { :controller => "geocoder", :action => "search_geonames" }
+    )
 
-class GeocoderControllerTest < Test::Unit::TestCase
-  def setup
-    @controller = GeocoderController.new
-    @request    = ActionController::TestRequest.new
-    @response   = ActionController::TestResponse.new
-  end
-
-  # Replace this with your real tests.
-  def test_truth
-    assert true
+    assert_routing(
+      { :path => "/geocoder/description", :method => :post },
+      { :controller => "geocoder", :action => "description" }
+    )
+    assert_routing(
+      { :path => "/geocoder/description_osm_namefinder", :method => :get },
+      { :controller => "geocoder", :action => "description_osm_namefinder" }
+    )
+    assert_routing(
+      { :path => "/geocoder/description_osm_nominatim", :method => :get },
+      { :controller => "geocoder", :action => "description_osm_nominatim" }
+    )
+    assert_routing(
+      { :path => "/geocoder/description_geonames", :method => :get },
+      { :controller => "geocoder", :action => "description_geonames" }
+    )
   end
 end