Pluralize old_ controllers

This commit is contained in:
Andy Allan 2018-11-07 16:02:22 +01:00
parent 05117aa928
commit e85c56d151
9 changed files with 28 additions and 31 deletions

View 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

View 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

View 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

View 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