]> git.openstreetmap.org Git - rails.git/commitdiff
Merge pull request #4557 from AntonKhorev/rename-api-old-version
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 13 Mar 2024 15:51:41 +0000 (15:51 +0000)
committerGitHub <noreply@github.com>
Wed, 13 Mar 2024 15:51:41 +0000 (15:51 +0000)
Rename api old element actions and path helpers

17 files changed:
app/abilities/api_ability.rb
app/controllers/api/old_controller.rb
app/views/api/old_nodes/show.json.jbuilder [moved from app/views/api/old_nodes/version.json.jbuilder with 100% similarity]
app/views/api/old_nodes/show.xml.builder [moved from app/views/api/old_nodes/version.xml.builder with 100% similarity]
app/views/api/old_relations/show.json.jbuilder [moved from app/views/api/old_relations/version.json.jbuilder with 100% similarity]
app/views/api/old_relations/show.xml.builder [moved from app/views/api/old_relations/version.xml.builder with 100% similarity]
app/views/api/old_ways/show.json.jbuilder [moved from app/views/api/old_ways/version.json.jbuilder with 100% similarity]
app/views/api/old_ways/show.xml.builder [moved from app/views/api/old_ways/version.xml.builder with 100% similarity]
app/views/browse/_version_actions.erb
config/routes.rb
test/controllers/api/old_nodes_controller_test.rb
test/controllers/api/old_relations_controller_test.rb
test/controllers/api/old_ways_controller_test.rb
test/controllers/api/relations_controller_test.rb
test/controllers/old_nodes_controller_test.rb
test/controllers/old_relations_controller_test.rb
test/controllers/old_ways_controller_test.rb

index 0eae46f824294aab6a703987cc80a3d2091c9768..8ee280b3a116d2f464c9114b1c65f47b45d50d39 100644 (file)
@@ -17,9 +17,7 @@ class ApiAbility
       can [:index, :show], Node
       can [:index, :show, :full, :ways_for_node], Way
       can [:index, :show, :full, :relations_for_node, :relations_for_way, :relations_for_relation], Relation
-      can [:history, :version], OldNode
-      can [:history, :version], OldWay
-      can [:history, :version], OldRelation
+      can [:history, :show], [OldNode, OldWay, OldRelation]
       can [:show], UserBlock
 
       if user&.active?
index ceed10978d9b614dbab6fa16298189ee9b5565ea..7c9c32e639a12602ee6678bcf800fdbbf5f1cb1c 100644 (file)
@@ -7,7 +7,7 @@ module Api
 
     before_action :check_api_readable
     before_action :check_api_writable, :only => [:redact]
-    before_action :setup_user_auth, :only => [:history, :version]
+    before_action :setup_user_auth, :only => [:history, :show]
     before_action :authorize, :only => [:redact]
 
     authorize_resource
@@ -38,7 +38,7 @@ module Api
       end
     end
 
-    def version
+    def show
       if @old_element.redacted? && !show_redactions?
         head :forbidden
 
index 46bfd0dc2c1628e7ea1536743ad4ed3f8fc7a13e..3d4e4be13ea8acf3d8de8577828ce8b463af1f43 100644 (file)
@@ -2,7 +2,7 @@
   <%= link_to t("browse.view_details"), :controller => :browse, :action => @type %>
   <% if !@feature.redacted? %>
     &middot;
-    <%= link_to t("browse.download_xml"), :controller => "api/old_#{@type.pluralize}", :action => :version %>
+    <%= link_to t("browse.download_xml"), :controller => "api/old_#{@type.pluralize}", :action => :show %>
   <% elsif current_user&.moderator? %>
     &middot;
     <% if !params[:show_redactions] %>
index 98184e0e176661cf5dbd4baa90e848a39918cf19..fad5f5a4b406f0a34e10c331e948e723d610421d 100644 (file)
@@ -35,7 +35,7 @@ OpenStreetMap::Application.routes.draw do
     get "node/:id/relations" => "api/relations#relations_for_node", :as => :node_relations, :id => /\d+/
     get "node/:id/history" => "api/old_nodes#history", :as => :api_node_history, :id => /\d+/
     post "node/:id/:version/redact" => "api/old_nodes#redact", :as => :node_version_redact, :version => /\d+/, :id => /\d+/
-    get "node/:id/:version" => "api/old_nodes#version", :as => :node_version, :id => /\d+/, :version => /\d+/
+    get "node/:id/:version" => "api/old_nodes#show", :as => :api_old_node, :id => /\d+/, :version => /\d+/
     get "node/:id" => "api/nodes#show", :as => :api_node, :id => /\d+/
     put "node/:id" => "api/nodes#update", :id => /\d+/
     delete "node/:id" => "api/nodes#delete", :id => /\d+/
@@ -46,7 +46,7 @@ OpenStreetMap::Application.routes.draw do
     get "way/:id/full" => "api/ways#full", :as => :way_full, :id => /\d+/
     get "way/:id/relations" => "api/relations#relations_for_way", :as => :way_relations, :id => /\d+/
     post "way/:id/:version/redact" => "api/old_ways#redact", :as => :way_version_redact, :version => /\d+/, :id => /\d+/
-    get "way/:id/:version" => "api/old_ways#version", :as => :way_version, :id => /\d+/, :version => /\d+/
+    get "way/:id/:version" => "api/old_ways#show", :as => :api_old_way, :id => /\d+/, :version => /\d+/
     get "way/:id" => "api/ways#show", :as => :api_way, :id => /\d+/
     put "way/:id" => "api/ways#update", :id => /\d+/
     delete "way/:id" => "api/ways#delete", :id => /\d+/
@@ -57,7 +57,7 @@ OpenStreetMap::Application.routes.draw do
     get "relation/:id/history" => "api/old_relations#history", :as => :api_relation_history, :id => /\d+/
     get "relation/:id/full" => "api/relations#full", :as => :relation_full, :id => /\d+/
     post "relation/:id/:version/redact" => "api/old_relations#redact", :as => :relation_version_redact, :version => /\d+/, :id => /\d+/
-    get "relation/:id/:version" => "api/old_relations#version", :as => :relation_version, :id => /\d+/, :version => /\d+/
+    get "relation/:id/:version" => "api/old_relations#show", :as => :api_old_relation, :id => /\d+/, :version => /\d+/
     get "relation/:id" => "api/relations#show", :as => :api_relation, :id => /\d+/
     put "relation/:id" => "api/relations#update", :id => /\d+/
     delete "relation/:id" => "api/relations#delete", :id => /\d+/
index 737f11c7317b697406e954500e32339a89bd5067..a982705edeb1e5385a3f410495afe97160ebbc70 100644 (file)
@@ -15,7 +15,7 @@ module Api
       )
       assert_routing(
         { :path => "/api/0.6/node/1/2", :method => :get },
-        { :controller => "api/old_nodes", :action => "version", :id => "1", :version => "2" }
+        { :controller => "api/old_nodes", :action => "show", :id => "1", :version => "2" }
       )
       assert_routing(
         { :path => "/api/0.6/node/1/history.json", :method => :get },
@@ -23,7 +23,7 @@ module Api
       )
       assert_routing(
         { :path => "/api/0.6/node/1/2.json", :method => :get },
-        { :controller => "api/old_nodes", :action => "version", :id => "1", :version => "2", :format => "json" }
+        { :controller => "api/old_nodes", :action => "show", :id => "1", :version => "2", :format => "json" }
       )
       assert_routing(
         { :path => "/api/0.6/node/1/2/redact", :method => :post },
@@ -142,7 +142,7 @@ module Api
 
       # check all the versions
       versions.each_key do |key|
-        get node_version_path(:id => nodeid, :version => key.to_i)
+        get api_old_node_path(:id => nodeid, :version => key.to_i)
 
         assert_response :success,
                         "couldn't get version #{key.to_i} of node #{nodeid}"
@@ -283,12 +283,12 @@ module Api
       node_v1 = node.old_nodes.find_by(:version => 1)
       node_v1.redact!(create(:redaction))
 
-      get node_version_path(:id => node_v1.node_id, :version => node_v1.version)
+      get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version)
       assert_response :forbidden, "Redacted node shouldn't be visible via the version API."
 
       # not even to a logged-in user
       auth_header = basic_authorization_header create(:user).email, "test"
-      get node_version_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
+      get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
       assert_response :forbidden, "Redacted node shouldn't be visible via the version API, even when logged in."
     end
 
@@ -325,9 +325,9 @@ module Api
 
       # check moderator can still see the redacted data, when passing
       # the appropriate flag
-      get node_version_path(:id => node_v3.node_id, :version => node_v3.version), :headers => auth_header
+      get api_old_node_path(:id => node_v3.node_id, :version => node_v3.version), :headers => auth_header
       assert_response :forbidden, "After redaction, node should be gone for moderator, when flag not passed."
-      get node_version_path(:id => node_v3.node_id, :version => node_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
+      get api_old_node_path(:id => node_v3.node_id, :version => node_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
       assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
 
       # and when accessed via history
@@ -355,7 +355,7 @@ module Api
       auth_header = basic_authorization_header create(:user).email, "test"
 
       # check can't see the redacted data
-      get node_version_path(:id => node_v3.node_id, :version => node_v3.version), :headers => auth_header
+      get api_old_node_path(:id => node_v3.node_id, :version => node_v3.version), :headers => auth_header
       assert_response :forbidden, "Redacted node shouldn't be visible via the version API."
 
       # and when accessed via history
@@ -408,7 +408,7 @@ module Api
 
       # check moderator can now see the redacted data, when not
       # passing the aspecial flag
-      get node_version_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
+      get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
       assert_response :success, "After unredaction, node should not be gone for moderator."
 
       # and when accessed via history
@@ -420,7 +420,7 @@ module Api
       auth_header = basic_authorization_header create(:user).email, "test"
 
       # check normal user can now see the redacted data
-      get node_version_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
+      get api_old_node_path(:id => node_v1.node_id, :version => node_v1.version), :headers => auth_header
       assert_response :success, "After unredaction, node should be visible to normal users."
 
       # and when accessed via history
@@ -446,7 +446,7 @@ module Api
     end
 
     def do_redact_node(node, redaction, headers = {})
-      get node_version_path(:id => node.node_id, :version => node.version), :headers => headers
+      get api_old_node_path(:id => node.node_id, :version => node.version), :headers => headers
       assert_response :success, "should be able to get version #{node.version} of node #{node.node_id}."
 
       # now redact it
@@ -463,7 +463,7 @@ module Api
       assert_not_nil current_node, "getting node #{node_id} returned nil"
 
       # get the "old" version of the node from the old_node interface
-      get node_version_path(:id => node_id, :version => current_node.version)
+      get api_old_node_path(:id => node_id, :version => current_node.version)
       assert_response :success, "cant get old node #{node_id}, v#{current_node.version}"
       old_node = Node.from_xml(@response.body)
 
@@ -472,7 +472,7 @@ module Api
     end
 
     def check_not_found_id_version(id, version)
-      get node_version_path(:id => id, :version => version)
+      get api_old_node_path(:id => id, :version => version)
       assert_response :not_found
     rescue ActionController::UrlGenerationError => e
       assert_match(/No route matches/, e.to_s)
index ea26e5cb795c60bfa523f411fb458b4c2dfc0037..4002711230658c96a4b7c2f3e26826d6f14a5b2a 100644 (file)
@@ -11,7 +11,7 @@ module Api
       )
       assert_routing(
         { :path => "/api/0.6/relation/1/2", :method => :get },
-        { :controller => "api/old_relations", :action => "version", :id => "1", :version => "2" }
+        { :controller => "api/old_relations", :action => "show", :id => "1", :version => "2" }
       )
       assert_routing(
         { :path => "/api/0.6/relation/1/history.json", :method => :get },
@@ -19,7 +19,7 @@ module Api
       )
       assert_routing(
         { :path => "/api/0.6/relation/1/2.json", :method => :get },
-        { :controller => "api/old_relations", :action => "version", :id => "1", :version => "2", :format => "json" }
+        { :controller => "api/old_relations", :action => "show", :id => "1", :version => "2", :format => "json" }
       )
       assert_routing(
         { :path => "/api/0.6/relation/1/2/redact", :method => :post },
@@ -122,12 +122,12 @@ module Api
       relation_v1 = relation.old_relations.find_by(:version => 1)
       relation_v1.redact!(create(:redaction))
 
-      get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version)
+      get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version)
       assert_response :forbidden, "Redacted relation shouldn't be visible via the version API."
 
       # not even to a logged-in user
       auth_header = basic_authorization_header create(:user).email, "test"
-      get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
+      get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
       assert_response :forbidden, "Redacted relation shouldn't be visible via the version API, even when logged in."
     end
 
@@ -145,7 +145,7 @@ module Api
 
       # not even to a logged-in user
       auth_header = basic_authorization_header create(:user).email, "test"
-      get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
+      get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
       get api_relation_history_path(:id => relation_v1.relation_id), :headers => auth_header
       assert_response :success, "Redaction shouldn't have stopped history working."
       assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 0,
@@ -166,9 +166,9 @@ module Api
 
       # check moderator can still see the redacted data, when passing
       # the appropriate flag
-      get relation_version_path(:id => relation_v3.relation_id, :version => relation_v3.version), :headers => auth_header
+      get api_old_relation_path(:id => relation_v3.relation_id, :version => relation_v3.version), :headers => auth_header
       assert_response :forbidden, "After redaction, relation should be gone for moderator, when flag not passed."
-      get relation_version_path(:id => relation_v3.relation_id, :version => relation_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
+      get api_old_relation_path(:id => relation_v3.relation_id, :version => relation_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
       assert_response :success, "After redaction, relation should not be gone for moderator, when flag passed."
 
       # and when accessed via history
@@ -197,7 +197,7 @@ module Api
       auth_header = basic_authorization_header create(:user).email, "test"
 
       # check can't see the redacted data
-      get relation_version_path(:id => relation_v3.relation_id, :version => relation_v3.version), :headers => auth_header
+      get api_old_relation_path(:id => relation_v3.relation_id, :version => relation_v3.version), :headers => auth_header
       assert_response :forbidden, "Redacted relation shouldn't be visible via the version API."
 
       # and when accessed via history
@@ -248,7 +248,7 @@ module Api
 
       # check moderator can still see the redacted data, without passing
       # the appropriate flag
-      get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
+      get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
       assert_response :success, "After unredaction, relation should not be gone for moderator."
 
       # and when accessed via history
@@ -260,7 +260,7 @@ module Api
       auth_header = basic_authorization_header create(:user).email, "test"
 
       # check normal user can now see the redacted data
-      get relation_version_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
+      get api_old_relation_path(:id => relation_v1.relation_id, :version => relation_v1.version), :headers => auth_header
       assert_response :success, "After redaction, node should not be gone for normal user."
 
       # and when accessed via history
@@ -329,7 +329,7 @@ module Api
     end
 
     def do_redact_relation(relation, redaction, headers = {})
-      get relation_version_path(:id => relation.relation_id, :version => relation.version)
+      get api_old_relation_path(:id => relation.relation_id, :version => relation.version)
       assert_response :success, "should be able to get version #{relation.version} of relation #{relation.relation_id}."
 
       # now redact it
index 4c225fb3347febcaecb710b8913a0686d3065f86..959c3514a20e5e12880d724b7ad184e4cd5237bf 100644 (file)
@@ -11,7 +11,7 @@ module Api
       )
       assert_routing(
         { :path => "/api/0.6/way/1/2", :method => :get },
-        { :controller => "api/old_ways", :action => "version", :id => "1", :version => "2" }
+        { :controller => "api/old_ways", :action => "show", :id => "1", :version => "2" }
       )
       assert_routing(
         { :path => "/api/0.6/way/1/history.json", :method => :get },
@@ -19,7 +19,7 @@ module Api
       )
       assert_routing(
         { :path => "/api/0.6/way/1/2.json", :method => :get },
-        { :controller => "api/old_ways", :action => "version", :id => "1", :version => "2", :format => "json" }
+        { :controller => "api/old_ways", :action => "show", :id => "1", :version => "2", :format => "json" }
       )
       assert_routing(
         { :path => "/api/0.6/way/1/2/redact", :method => :post },
@@ -163,12 +163,12 @@ module Api
       way_v1 = way.old_ways.find_by(:version => 1)
       way_v1.redact!(create(:redaction))
 
-      get way_version_path(:id => way_v1.way_id, :version => way_v1.version)
+      get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version)
       assert_response :forbidden, "Redacted way shouldn't be visible via the version API."
 
       # not even to a logged-in user
       auth_header = basic_authorization_header create(:user).email, "test"
-      get way_version_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
+      get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
       assert_response :forbidden, "Redacted way shouldn't be visible via the version API, even when logged in."
     end
 
@@ -186,7 +186,6 @@ module Api
 
       # not even to a logged-in user
       auth_header = basic_authorization_header create(:user).email, "test"
-      get way_version_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
       get api_way_history_path(:id => way_v1.way_id), :headers => auth_header
       assert_response :success, "Redaction shouldn't have stopped history working."
       assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 0,
@@ -206,9 +205,9 @@ module Api
 
       # check moderator can still see the redacted data, when passing
       # the appropriate flag
-      get way_version_path(:id => way_v3.way_id, :version => way_v3.version), :headers => auth_header
+      get api_old_way_path(:id => way_v3.way_id, :version => way_v3.version), :headers => auth_header
       assert_response :forbidden, "After redaction, node should be gone for moderator, when flag not passed."
-      get way_version_path(:id => way_v3.way_id, :version => way_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
+      get api_old_way_path(:id => way_v3.way_id, :version => way_v3.version), :params => { :show_redactions => "true" }, :headers => auth_header
       assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
 
       # and when accessed via history
@@ -236,7 +235,7 @@ module Api
       auth_header = basic_authorization_header create(:user).email, "test"
 
       # check can't see the redacted data
-      get way_version_path(:id => way_v3.way_id, :version => way_v3.version), :headers => auth_header
+      get api_old_way_path(:id => way_v3.way_id, :version => way_v3.version), :headers => auth_header
       assert_response :forbidden, "Redacted node shouldn't be visible via the version API."
 
       # and when accessed via history
@@ -288,7 +287,7 @@ module Api
 
       # check moderator can still see the unredacted data, without passing
       # the appropriate flag
-      get way_version_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
+      get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
       assert_response :success, "After unredaction, node should not be gone for moderator."
 
       # and when accessed via history
@@ -300,7 +299,7 @@ module Api
       auth_header = basic_authorization_header create(:user).email, "test"
 
       # check normal user can now see the unredacted data
-      get way_version_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
+      get api_old_way_path(:id => way_v1.way_id, :version => way_v1.version), :headers => auth_header
       assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
 
       # and when accessed via history
@@ -325,7 +324,7 @@ module Api
       assert_not_nil current_way, "getting way #{way_id} returned nil"
 
       # get the "old" version of the way from the version method
-      get way_version_path(:id => way_id, :version => current_way.version)
+      get api_old_way_path(:id => way_id, :version => current_way.version)
       assert_response :success, "can't get old way #{way_id}, v#{current_way.version}"
       old_way = Way.from_xml(@response.body)
 
@@ -346,7 +345,7 @@ module Api
         history_way = Way.from_xml_node(way_doc)
         assert_not_nil history_way, "parsing way #{way_id} version failed"
 
-        get way_version_path(:id => way_id, :version => history_way.version)
+        get api_old_way_path(:id => way_id, :version => history_way.version)
         assert_response :success, "couldn't get way #{way_id}, v#{history_way.version}"
         version_way = Way.from_xml(@response.body)
         assert_not_nil version_way, "failed to parse #{way_id}, v#{history_way.version}"
@@ -369,7 +368,7 @@ module Api
     end
 
     def do_redact_way(way, redaction, headers = {})
-      get way_version_path(:id => way.way_id, :version => way.version)
+      get api_old_way_path(:id => way.way_id, :version => way.version)
       assert_response :success, "should be able to get version #{way.version} of way #{way.way_id}."
 
       # now redact it
index e6f507d3a84169446370854db4164e96bee033e0..7ff369fa4abdd73590572a07e0d0b21d96ef04d9 100644 (file)
@@ -788,7 +788,7 @@ module Api
 
       # check the ordering in the history tables:
       with_controller(OldRelationsController.new) do
-        get relation_version_path(:id => relation_id, :version => 2)
+        get api_old_relation_path(:id => relation_id, :version => 2)
         assert_response :success, "can't read back version 2 of the relation #{relation_id}"
         check_ordering(doc, @response.body)
       end
@@ -868,7 +868,7 @@ module Api
 
       # check the ordering in the history tables:
       with_controller(OldRelationsController.new) do
-        get relation_version_path(:id => relation_id, :version => 1)
+        get api_old_relation_path(:id => relation_id, :version => 1)
         assert_response :success, "can't read back version 1 of the relation: #{@response.body}"
         check_ordering(doc, @response.body)
       end
@@ -1109,7 +1109,7 @@ module Api
         get api_relation_path(:id => id)
       else
         with_controller(OldRelationsController.new) do
-          get relation_version_path(:id => id, :version => ver)
+          get api_old_relation_path(:id => id, :version => ver)
         end
       end
       assert_response :success
index a1232be762e9c75b0624deb5fba3b95f2bbfc0ee..81a98766abebfca4e6e22609620f78d351cc3fe1 100644 (file)
@@ -17,7 +17,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest
     assert_select "h4", /^Version/ do
       assert_select "a[href='#{old_node_path node, 1}']", :count => 0
     end
-    assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 1
+    assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 1
     assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_node_path node, 1, :params => { :show_redactions => true }}']", :count => 0
     assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1
@@ -32,7 +32,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest
     assert_select "h4", /^Version/ do
       assert_select "a[href='#{old_node_path node, 1}']", :count => 0
     end
-    assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 1
+    assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 1
     assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1
     assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_node_path node, 2}']", :count => 1
@@ -44,7 +44,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest
     assert_select "h4", /^Version/ do
       assert_select "a[href='#{old_node_path node, 2}']", :count => 0
     end
-    assert_select ".secondary-actions a[href='#{node_version_path node, 2}']", :count => 1
+    assert_select ".secondary-actions a[href='#{api_old_node_path node, 2}']", :count => 1
     assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1
     assert_select ".secondary-actions a[href='#{node_history_path node}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 1
@@ -60,7 +60,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest
     assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_node_path node, 1, :params => { :show_redactions => true }}']", :count => 0
     assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 0
-    assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 0
+    assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 0
   end
 
   test "show unrevealed redacted versions to regular users" do
@@ -74,7 +74,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest
     assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_node_path node, 1, :params => { :show_redactions => true }}']", :count => 0
     assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 0
-    assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 0
+    assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 0
   end
 
   test "show unrevealed redacted versions to moderators" do
@@ -88,7 +88,7 @@ class OldNodesControllerTest < ActionDispatch::IntegrationTest
     assert_select ".secondary-actions a[href='#{node_path node}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_node_path node, 1, :params => { :show_redactions => true }}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_node_path node, 1}']", :count => 0
-    assert_select ".secondary-actions a[href='#{node_version_path node, 1}']", :count => 0
+    assert_select ".secondary-actions a[href='#{api_old_node_path node, 1}']", :count => 0
   end
 
   test "don't reveal redacted versions to anonymous users" do
index 6eb6db9ddc111a6fb014c5e8cf8c46481f870650..66a960e6f74efa87377ed668d3ec76156da6723f 100644 (file)
@@ -17,7 +17,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
     assert_select "h4", /^Version/ do
       assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0
     end
-    assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 1
+    assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 1
     assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 0
     assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1
@@ -32,7 +32,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
     assert_select "h4", /^Version/ do
       assert_select "a[href='#{old_relation_path relation, 1}']", :count => 0
     end
-    assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 1
+    assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 1
     assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
     assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_relation_path relation, 2}']", :count => 1
@@ -44,7 +44,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
     assert_select "h4", /^Version/ do
       assert_select "a[href='#{old_relation_path relation, 2}']", :count => 0
     end
-    assert_select ".secondary-actions a[href='#{relation_version_path relation, 2}']", :count => 1
+    assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 2}']", :count => 1
     assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
     assert_select ".secondary-actions a[href='#{relation_history_path relation}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 1
@@ -69,7 +69,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
     assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 0
     assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0
-    assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 0
+    assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 0
   end
 
   test "show unrevealed redacted versions to regular users" do
@@ -83,7 +83,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
     assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 0
     assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0
-    assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 0
+    assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 0
   end
 
   test "show unrevealed redacted versions to moderators" do
@@ -97,7 +97,7 @@ class OldRelationsControllerTest < ActionDispatch::IntegrationTest
     assert_select ".secondary-actions a[href='#{relation_path relation}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_relation_path relation, 1, :params => { :show_redactions => true }}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_relation_path relation, 1}']", :count => 0
-    assert_select ".secondary-actions a[href='#{relation_version_path relation, 1}']", :count => 0
+    assert_select ".secondary-actions a[href='#{api_old_relation_path relation, 1}']", :count => 0
   end
 
   test "don't reveal redacted versions to anonymous users" do
index d28a23ef5a602793d134cae90fb12c5b902f8493..65e26ef20acf912b42b220f1da4764b0d6d57e4c 100644 (file)
@@ -17,7 +17,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest
     assert_select "h4", /^Version/ do
       assert_select "a[href='#{old_way_path way, 1}']", :count => 0
     end
-    assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 1
+    assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 1
     assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_way_path way, 1, :params => { :show_redactions => true }}']", :count => 0
     assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1
@@ -32,7 +32,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest
     assert_select "h4", /^Version/ do
       assert_select "a[href='#{old_way_path way, 1}']", :count => 0
     end
-    assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 1
+    assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 1
     assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1
     assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_way_path way, 2}']", :count => 1
@@ -44,7 +44,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest
     assert_select "h4", /^Version/ do
       assert_select "a[href='#{old_way_path way, 2}']", :count => 0
     end
-    assert_select ".secondary-actions a[href='#{way_version_path way, 2}']", :count => 1
+    assert_select ".secondary-actions a[href='#{api_old_way_path way, 2}']", :count => 1
     assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1
     assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 1
@@ -74,7 +74,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest
     assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_way_path way, 1, :params => { :show_redactions => true }}']", :count => 0
     assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 0
-    assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 0
+    assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 0
   end
 
   test "show unrevealed redacted versions to regular users" do
@@ -88,7 +88,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest
     assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_way_path way, 1, :params => { :show_redactions => true }}']", :count => 0
     assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 0
-    assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 0
+    assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 0
   end
 
   test "show unrevealed redacted versions to moderators" do
@@ -102,7 +102,7 @@ class OldWaysControllerTest < ActionDispatch::IntegrationTest
     assert_select ".secondary-actions a[href='#{way_path way}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_way_path way, 1, :params => { :show_redactions => true }}']", :count => 1
     assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 0
-    assert_select ".secondary-actions a[href='#{way_version_path way, 1}']", :count => 0
+    assert_select ".secondary-actions a[href='#{api_old_way_path way, 1}']", :count => 0
   end
 
   test "don't reveal redacted versions to anonymous users" do