]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/api/ways_controller_test.rb
Move xml gen. into view for (old) nodes, ways, relations, map
[rails.git] / test / controllers / api / ways_controller_test.rb
index c390e8bc29d32e61290fdf03ed6b8756c9076fe2..3d04ef9589c4d93d61d2dfd32ae67dd95dc61508 100644 (file)
@@ -11,11 +11,11 @@ module Api
       )
       assert_routing(
         { :path => "/api/0.6/way/1/full", :method => :get },
-        { :controller => "api/ways", :action => "full", :id => "1" }
+        { :controller => "api/ways", :action => "full", :id => "1", :format => "xml" }
       )
       assert_routing(
         { :path => "/api/0.6/way/1", :method => :get },
-        { :controller => "api/ways", :action => "show", :id => "1" }
+        { :controller => "api/ways", :action => "show", :id => "1", :format => "xml" }
       )
       assert_routing(
         { :path => "/api/0.6/way/1", :method => :put },
@@ -27,7 +27,7 @@ module Api
       )
       assert_routing(
         { :path => "/api/0.6/ways", :method => :get },
-        { :controller => "api/ways", :action => "index" }
+        { :controller => "api/ways", :action => "index", :format => "xml" }
       )
     end
 
@@ -37,15 +37,15 @@ module Api
 
     def test_show
       # check that a visible way is returned properly
-      get :show, :params => { :id => create(:way).id }
+      get :show, :params => { :id => create(:way).id }, :format => :xml
       assert_response :success
 
       # check that an invisible way is not returned
-      get :show, :params => { :id => create(:way, :deleted).id }
+      get :show, :params => { :id => create(:way, :deleted).id }, :format => :xml
       assert_response :gone
 
       # check chat a non-existent way is not returned
-      get :show, :params => { :id => 0 }
+      get :show, :params => { :id => 0 }, :format => :xml
       assert_response :not_found
     end
 
@@ -86,15 +86,15 @@ module Api
       way4 = create(:way)
 
       # check error when no parameter provided
-      get :index
+      get :index, :format => :xml
       assert_response :bad_request
 
       # check error when no parameter value provided
-      get :index, :params => { :ways => "" }
+      get :index, :params => { :ways => "" }, :format => :xml
       assert_response :bad_request
 
       # test a working call
-      get :index, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id}" }
+      get :index, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id}" }, :format => :xml
       assert_response :success
       assert_select "osm" do
         assert_select "way", :count => 4
@@ -105,7 +105,7 @@ module Api
       end
 
       # check error when a non-existent way is included
-      get :index, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id},0" }
+      get :index, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id},0" }, :format => :xml
       assert_response :not_found
     end
 
@@ -711,7 +711,7 @@ module Api
       _way3_v2 = create(:old_way, :current_way => way3_v1.current_way, :version => 2)
       create(:old_way_node, :old_way => way3_v1, :node => node)
 
-      get :ways_for_node, :params => { :id => node.id }
+      get :ways_for_node, :params => { :id => node.id }, :format => :xml
       assert_response :success
       ways_xml = XML::Parser.string(@response.body).parse
       assert_not_nil ways_xml, "failed to parse ways_for_node response"