]> git.openstreetmap.org Git - rails.git/commitdiff
Pluralize old_ controllers
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 7 Nov 2018 15:02:22 +0000 (16:02 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 7 Nov 2018 15:05:56 +0000 (16:05 +0100)
app/controllers/old_nodes_controller.rb [moved from app/controllers/old_node_controller.rb with 84% similarity]
app/controllers/old_relations_controller.rb [moved from app/controllers/old_relation_controller.rb with 83% similarity]
app/controllers/old_ways_controller.rb [moved from app/controllers/old_way_controller.rb with 84% similarity]
app/views/browse/history.html.erb
config/routes.rb
test/controllers/old_nodes_controller_test.rb [moved from test/controllers/old_node_controller_test.rb with 98% similarity]
test/controllers/old_relations_controller_test.rb [moved from test/controllers/old_relation_controller_test.rb with 97% similarity]
test/controllers/old_ways_controller_test.rb [moved from test/controllers/old_way_controller_test.rb with 97% similarity]
test/controllers/relations_controller_test.rb

similarity index 84%
rename from app/controllers/old_node_controller.rb
rename to app/controllers/old_nodes_controller.rb
index a32e299fe6a2481833b901fd3995ceec475809d5..43c8b6b7572719b1c9a14fbc1afefb2c43a3acd7 100644 (file)
@@ -1,4 +1,4 @@
-class OldNodeController < OldController
+class OldNodesController < OldController
   private
 
   def lookup_old_element
similarity index 83%
rename from app/controllers/old_relation_controller.rb
rename to app/controllers/old_relations_controller.rb
index 78eca324cb4cb819e0450f089b179de947b074f3..40c450376a8e435cc8981c44cd9892ce15160653 100644 (file)
@@ -1,4 +1,4 @@
-class OldRelationController < OldController
+class OldRelationsController < OldController
   private
 
   def lookup_old_element
similarity index 84%
rename from app/controllers/old_way_controller.rb
rename to app/controllers/old_ways_controller.rb
index 1daab997ae2c4f72899e9d9276df89880d1af423..c8185c633dd7c605deb58bbc3134f047a37d1a65 100644 (file)
@@ -1,4 +1,4 @@
-class OldWayController < OldController
+class OldWaysController < OldController
   private
 
   def lookup_old_element
index 5f5dd4db3274b789890cac68a562ad72cfd3e191..6cf0a35698fc6e8eadcdf9337a54692a0dc9665b 100644 (file)
@@ -8,7 +8,7 @@
 <%= render :partial => @type, :collection => @feature.send("old_#{@type}s").reverse %>
 
 <div class='secondary-actions'>
-  <%= link_to(t('browse.download_xml'), :controller => "old_#{@type}", :action => "history") %>
+  <%= link_to(t('browse.download_xml'), :controller => "old_#{@type.pluralize}", :action => "history") %>
   &middot;
   <%= link_to(t('browse.view_details'), :action => @type) %>
 </div>
index 235ffdba3b23152630fe602ae3250c5614141ec2..71fcfd57dea6de3296a88fdf460a1942debf743f 100644 (file)
@@ -23,20 +23,20 @@ OpenStreetMap::Application.routes.draw do
     put "node/create" => "nodes#create"
     get "node/:id/ways" => "ways#ways_for_node", :id => /\d+/
     get "node/:id/relations" => "relations#relations_for_node", :id => /\d+/
-    get "node/:id/history" => "old_node#history", :id => /\d+/
-    post "node/:id/:version/redact" => "old_node#redact", :version => /\d+/, :id => /\d+/
-    get "node/:id/:version" => "old_node#version", :id => /\d+/, :version => /\d+/
+    get "node/:id/history" => "old_nodes#history", :id => /\d+/
+    post "node/:id/:version/redact" => "old_nodes#redact", :version => /\d+/, :id => /\d+/
+    get "node/:id/:version" => "old_nodes#version", :id => /\d+/, :version => /\d+/
     get "node/:id" => "nodes#read", :id => /\d+/
     put "node/:id" => "nodes#update", :id => /\d+/
     delete "node/:id" => "nodes#delete", :id => /\d+/
     get "nodes" => "nodes#nodes"
 
     put "way/create" => "ways#create"
-    get "way/:id/history" => "old_way#history", :id => /\d+/
+    get "way/:id/history" => "old_ways#history", :id => /\d+/
     get "way/:id/full" => "ways#full", :id => /\d+/
     get "way/:id/relations" => "relations#relations_for_way", :id => /\d+/
-    post "way/:id/:version/redact" => "old_way#redact", :version => /\d+/, :id => /\d+/
-    get "way/:id/:version" => "old_way#version", :id => /\d+/, :version => /\d+/
+    post "way/:id/:version/redact" => "old_ways#redact", :version => /\d+/, :id => /\d+/
+    get "way/:id/:version" => "old_ways#version", :id => /\d+/, :version => /\d+/
     get "way/:id" => "ways#read", :id => /\d+/
     put "way/:id" => "ways#update", :id => /\d+/
     delete "way/:id" => "ways#delete", :id => /\d+/
@@ -44,10 +44,10 @@ OpenStreetMap::Application.routes.draw do
 
     put "relation/create" => "relations#create"
     get "relation/:id/relations" => "relations#relations_for_relation", :id => /\d+/
-    get "relation/:id/history" => "old_relation#history", :id => /\d+/
+    get "relation/:id/history" => "old_relations#history", :id => /\d+/
     get "relation/:id/full" => "relations#full", :id => /\d+/
-    post "relation/:id/:version/redact" => "old_relation#redact", :version => /\d+/, :id => /\d+/
-    get "relation/:id/:version" => "old_relation#version", :id => /\d+/, :version => /\d+/
+    post "relation/:id/:version/redact" => "old_relations#redact", :version => /\d+/, :id => /\d+/
+    get "relation/:id/:version" => "old_relations#version", :id => /\d+/, :version => /\d+/
     get "relation/:id" => "relations#read", :id => /\d+/
     put "relation/:id" => "relations#update", :id => /\d+/
     delete "relation/:id" => "relations#delete", :id => /\d+/
similarity index 98%
rename from test/controllers/old_node_controller_test.rb
rename to test/controllers/old_nodes_controller_test.rb
index 0d8db0589e30e27fc94cf174574e0e92bb6765da..2568cbfd831e3e3c02af56f0299dce3ab50e993d 100644 (file)
@@ -1,7 +1,6 @@
 require "test_helper"
-require "old_node_controller"
 
-class OldNodeControllerTest < ActionController::TestCase
+class OldNodesControllerTest < ActionController::TestCase
   #
   # TODO: test history
   #
@@ -11,15 +10,15 @@ class OldNodeControllerTest < ActionController::TestCase
   def test_routes
     assert_routing(
       { :path => "/api/0.6/node/1/history", :method => :get },
-      { :controller => "old_node", :action => "history", :id => "1" }
+      { :controller => "old_nodes", :action => "history", :id => "1" }
     )
     assert_routing(
       { :path => "/api/0.6/node/1/2", :method => :get },
-      { :controller => "old_node", :action => "version", :id => "1", :version => "2" }
+      { :controller => "old_nodes", :action => "version", :id => "1", :version => "2" }
     )
     assert_routing(
       { :path => "/api/0.6/node/1/2/redact", :method => :post },
-      { :controller => "old_node", :action => "redact", :id => "1", :version => "2" }
+      { :controller => "old_nodes", :action => "redact", :id => "1", :version => "2" }
     )
   end
 
similarity index 97%
rename from test/controllers/old_relation_controller_test.rb
rename to test/controllers/old_relations_controller_test.rb
index c6f43dbdc29d5f3a52bfa5174d71156a32b741ae..51e6c565a315d936a50e0684610517cab1d7b834 100644 (file)
@@ -1,21 +1,20 @@
 require "test_helper"
-require "old_relation_controller"
 
-class OldRelationControllerTest < ActionController::TestCase
+class OldRelationsControllerTest < ActionController::TestCase
   ##
   # test all routes which lead to this controller
   def test_routes
     assert_routing(
       { :path => "/api/0.6/relation/1/history", :method => :get },
-      { :controller => "old_relation", :action => "history", :id => "1" }
+      { :controller => "old_relations", :action => "history", :id => "1" }
     )
     assert_routing(
       { :path => "/api/0.6/relation/1/2", :method => :get },
-      { :controller => "old_relation", :action => "version", :id => "1", :version => "2" }
+      { :controller => "old_relations", :action => "version", :id => "1", :version => "2" }
     )
     assert_routing(
       { :path => "/api/0.6/relation/1/2/redact", :method => :post },
-      { :controller => "old_relation", :action => "redact", :id => "1", :version => "2" }
+      { :controller => "old_relations", :action => "redact", :id => "1", :version => "2" }
     )
   end
 
similarity index 97%
rename from test/controllers/old_way_controller_test.rb
rename to test/controllers/old_ways_controller_test.rb
index 168ce87ddc9f8fdc0a32fc868f7f0cb003af75a0..0dd2d5e3c743ed20422d4dc771da137917e16671 100644 (file)
@@ -1,21 +1,20 @@
 require "test_helper"
-require "old_way_controller"
 
-class OldWayControllerTest < ActionController::TestCase
+class OldWaysControllerTest < ActionController::TestCase
   ##
   # test all routes which lead to this controller
   def test_routes
     assert_routing(
       { :path => "/api/0.6/way/1/history", :method => :get },
-      { :controller => "old_way", :action => "history", :id => "1" }
+      { :controller => "old_ways", :action => "history", :id => "1" }
     )
     assert_routing(
       { :path => "/api/0.6/way/1/2", :method => :get },
-      { :controller => "old_way", :action => "version", :id => "1", :version => "2" }
+      { :controller => "old_ways", :action => "version", :id => "1", :version => "2" }
     )
     assert_routing(
       { :path => "/api/0.6/way/1/2/redact", :method => :post },
-      { :controller => "old_way", :action => "redact", :id => "1", :version => "2" }
+      { :controller => "old_ways", :action => "redact", :id => "1", :version => "2" }
     )
   end
 
index be0f6c1d7a3901525fd1bd059bf0f99a3173802a..1613fbf7a8cb924b8241d0c3ee67f065a38af94b 100644 (file)
@@ -784,7 +784,7 @@ OSM
     check_ordering(doc, @response.body)
 
     # check the ordering in the history tables:
-    with_controller(OldRelationController.new) do
+    with_controller(OldRelationsController.new) do
       get :version, :params => { :id => relation_id, :version => 2 }
       assert_response :success, "can't read back version 2 of the relation #{relation_id}"
       check_ordering(doc, @response.body)
@@ -867,7 +867,7 @@ OSM
     check_ordering(doc, @response.body)
 
     # check the ordering in the history tables:
-    with_controller(OldRelationController.new) do
+    with_controller(OldRelationsController.new) do
       get :version, :params => { :id => relation_id, :version => 1 }
       assert_response :success, "can't read back version 1 of the relation: #{@response.body}"
       check_ordering(doc, @response.body)
@@ -981,7 +981,7 @@ OSM
     if ver.nil?
       get :read, :params => { :id => id }
     else
-      with_controller(OldRelationController.new) do
+      with_controller(OldRelationsController.new) do
         get :version, :params => { :id => id, :version => ver }
       end
     end