]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/2118'
authorTom Hughes <tom@compton.nu>
Wed, 16 Jan 2019 12:22:31 +0000 (12:22 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 16 Jan 2019 12:22:31 +0000 (12:22 +0000)
16 files changed:
app/abilities/ability.rb
app/controllers/changesets_controller.rb
app/controllers/nodes_controller.rb
app/controllers/relations_controller.rb
app/controllers/ways_controller.rb
app/views/browse/changeset.html.erb
app/views/browse/feature.html.erb
app/views/changesets/index.atom.builder
config/routes.rb
test/controllers/changesets_controller_test.rb
test/controllers/nodes_controller_test.rb
test/controllers/old_nodes_controller_test.rb
test/controllers/old_relations_controller_test.rb
test/controllers/old_ways_controller_test.rb
test/controllers/relations_controller_test.rb
test/controllers/ways_controller_test.rb

index 90f37793159d34a502602e8e7d6912ed46fd101d..c4cca7cc5f0474ebefacd834d226ce0aedc9b24b 100644 (file)
@@ -7,7 +7,7 @@ class Ability
     can [:trackpoints, :map, :changes, :capabilities, :permissions], :api
     can [:relation, :relation_history, :way, :way_history, :node, :node_history,
          :changeset, :note, :new_note, :query], :browse
-    can [:index, :feed, :read, :download, :query], Changeset
+    can [:index, :feed, :show, :download, :query], Changeset
     can :index, ChangesetComment
     can :search, :direction
     can [:index, :permalink, :edit, :help, :fixthemap, :offline, :export, :about, :preview, :copyright, :key, :id], :site
@@ -23,9 +23,9 @@ class Ability
     can [:index, :show, :data, :georss, :picture, :icon], Trace
     can [:terms, :api_users, :login, :logout, :new, :create, :save, :confirm, :confirm_resend, :confirm_email, :lost_password, :reset_password, :show, :api_read, :auth_success, :auth_failure], User
     can [:index, :show, :blocks_on, :blocks_by], UserBlock
-    can [:read, :nodes], Node
-    can [:read, :full, :ways, :ways_for_node], Way
-    can [:read, :full, :relations, :relations_for_node, :relations_for_way, :relations_for_relation], Relation
+    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
index 97ff85f0259cc90f4a3b3dc7186e679f5f5fc5c5..80b8aff48c4e590c83bf655cff6fc34b4e982337 100644 (file)
@@ -42,7 +42,7 @@ class ChangesetsController < ApplicationController
   ##
   # Return XML giving the basic info about the changeset. Does not
   # return anything about the nodes, ways and relations in the changeset.
-  def read
+  def show
     changeset = Changeset.find(params[:id])
 
     render :xml => changeset.to_xml(params[:include_discussion].presence).to_s
index 65f9b27ed1a64150c482ccf3c44c6af3d98a44e0..6c1d66db4c1dd9edb078e07103640d3341b120d1 100644 (file)
@@ -26,7 +26,7 @@ class NodesController < ApplicationController
   end
 
   # Dump the details on a node given in params[:id]
-  def read
+  def show
     node = Node.find(params[:id])
 
     response.last_modified = node.timestamp
@@ -63,7 +63,7 @@ class NodesController < ApplicationController
   end
 
   # Dump the details on many nodes whose ids are given in the "nodes" parameter.
-  def nodes
+  def index
     raise OSM::APIBadUserInput, "The parameter nodes is required, and must be of the form nodes=id[,id[,id...]]" unless params["nodes"]
 
     ids = params["nodes"].split(",").collect(&:to_i)
index 27bf5cdf8c945b73d5512f5a0b639ea7047fbf6a..8c8005acc68d5e0c3138523b000b49370dfb09e1 100644 (file)
@@ -22,7 +22,7 @@ class RelationsController < ApplicationController
     render :plain => relation.id.to_s
   end
 
-  def read
+  def show
     relation = Relation.find(params[:id])
     response.last_modified = relation.timestamp
     if relation.visible
@@ -123,7 +123,7 @@ class RelationsController < ApplicationController
     end
   end
 
-  def relations
+  def index
     raise OSM::APIBadUserInput, "The parameter relations is required, and must be of the form relations=id[,id[,id...]]" unless params["relations"]
 
     ids = params["relations"].split(",").collect(&:to_i)
index 85d9b5a5b0fb32f4e116d082993b18edd8c7045d..caf787105058777fc02cef641aedc77dd7f669b9 100644 (file)
@@ -22,7 +22,7 @@ class WaysController < ApplicationController
     render :plain => way.id.to_s
   end
 
-  def read
+  def show
     way = Way.find(params[:id])
 
     response.last_modified = way.timestamp
@@ -82,7 +82,7 @@ class WaysController < ApplicationController
     end
   end
 
-  def ways
+  def index
     unless params["ways"]
       raise OSM::APIBadUserInput, "The parameter ways is required, and must be of the form ways=id[,id[,id...]]"
     end
index c63b0112e0819d07e4cfbc53d937dc0400241217..0b73fa083d62bdaea53a90148abc799b4eab448d 100644 (file)
 <% end %>
 
 <div class='secondary-actions'>
-  <%= link_to(t('.changesetxml'), :controller => "changesets", :action => "read") %>
+  <%= link_to(t('.changesetxml'), :controller => "changesets", :action => "show") %>
   &middot;
   <%= link_to(t('.osmchangexml'), :controller => "changesets", :action => "download") %>
 </div>
index c3fadbe312e26a516fcb2d623f9bc3cf0a48dc75..5674f21b08af018a16be415be697abb45fee47d6 100644 (file)
@@ -8,7 +8,7 @@
 <%= render :partial => @type, :object => @feature %>
 
 <div class='secondary-actions'>
-  <%= link_to(t('browse.download_xml'), :controller => @type.pluralize, :action => "read") %>
+  <%= link_to(t('browse.download_xml'), :controller => @type.pluralize, :action => :show) %>
   &middot;
   <%= link_to(t('browse.view_history'), :action => "#{@type}_history") %>
 </div>
index 57befe117b5e39e9f726221f453eae66db277eaf..05d9ab68ac306cf28830b714a70488ab97a8582c 100644 (file)
@@ -17,7 +17,7 @@ atom_feed(:language => I18n.locale, :schema_date => 2009,
   @edits.each do |changeset|
     feed.entry(changeset, :updated => changeset.closed_at, :id => changeset_url(changeset.id, :only_path => false)) do |entry|
       entry.link :rel => "alternate",
-                 :href => changeset_read_url(changeset, :only_path => false),
+                 :href => changeset_show_url(changeset, :only_path => false),
                  :type => "application/osm+xml"
       entry.link :rel => "alternate",
                  :href => changeset_download_url(changeset, :only_path => false),
index b245e8fec0c155b587e5d52c499eedcb607718d3..b0fe5e48e889087a55b5ee2e47e93e4e907213d3 100644 (file)
@@ -10,7 +10,7 @@ OpenStreetMap::Application.routes.draw do
     post "changeset/:id/upload" => "changesets#upload", :id => /\d+/
     get "changeset/:id/download" => "changesets#download", :as => :changeset_download, :id => /\d+/
     post "changeset/:id/expand_bbox" => "changesets#expand_bbox", :id => /\d+/
-    get "changeset/:id" => "changesets#read", :as => :changeset_read, :id => /\d+/
+    get "changeset/:id" => "changesets#show", :as => :changeset_show, :id => /\d+/
     post "changeset/:id/subscribe" => "changesets#subscribe", :as => :changeset_subscribe, :id => /\d+/
     post "changeset/:id/unsubscribe" => "changesets#unsubscribe", :as => :changeset_unsubscribe, :id => /\d+/
     put "changeset/:id" => "changesets#update", :id => /\d+/
@@ -26,10 +26,10 @@ OpenStreetMap::Application.routes.draw do
     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+/
+    get "node/:id" => "nodes#show", :id => /\d+/
     put "node/:id" => "nodes#update", :id => /\d+/
     delete "node/:id" => "nodes#delete", :id => /\d+/
-    get "nodes" => "nodes#nodes"
+    get "nodes" => "nodes#index"
 
     put "way/create" => "ways#create"
     get "way/:id/history" => "old_ways#history", :id => /\d+/
@@ -37,10 +37,10 @@ OpenStreetMap::Application.routes.draw do
     get "way/:id/relations" => "relations#relations_for_way", :id => /\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+/
+    get "way/:id" => "ways#show", :id => /\d+/
     put "way/:id" => "ways#update", :id => /\d+/
     delete "way/:id" => "ways#delete", :id => /\d+/
-    get "ways" => "ways#ways"
+    get "ways" => "ways#index"
 
     put "relation/create" => "relations#create"
     get "relation/:id/relations" => "relations#relations_for_relation", :id => /\d+/
@@ -48,10 +48,10 @@ OpenStreetMap::Application.routes.draw do
     get "relation/:id/full" => "relations#full", :id => /\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+/
+    get "relation/:id" => "relations#show", :id => /\d+/
     put "relation/:id" => "relations#update", :id => /\d+/
     delete "relation/:id" => "relations#delete", :id => /\d+/
-    get "relations" => "relations#relations"
+    get "relations" => "relations#index"
 
     get "map" => "api#map"
 
index 35ee9c469d60b0380120c1fc6f03319766fc3a53..a3c8947ca6e2eec779aa58152cd249bd559444fe 100644 (file)
@@ -22,7 +22,7 @@ class ChangesetsControllerTest < ActionController::TestCase
     )
     assert_routing(
       { :path => "/api/0.6/changeset/1", :method => :get },
-      { :controller => "changesets", :action => "read", :id => "1" }
+      { :controller => "changesets", :action => "show", :id => "1" }
     )
     assert_routing(
       { :path => "/api/0.6/changeset/1/subscribe", :method => :post },
@@ -152,19 +152,19 @@ class ChangesetsControllerTest < ActionController::TestCase
   end
 
   ##
-  # check that the changeset can be read and returns the correct
+  # check that the changeset can be shown and returns the correct
   # document structure.
-  def test_read
+  def test_show
     changeset_id = create(:changeset).id
 
-    get :read, :params => { :id => changeset_id }
+    get :show, :params => { :id => changeset_id }
     assert_response :success, "cannot get first changeset"
 
     assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
     assert_select "osm>changeset[id='#{changeset_id}']", 1
     assert_select "osm>changeset>discussion", 0
 
-    get :read, :params => { :id => changeset_id, :include_discussion => true }
+    get :show, :params => { :id => changeset_id, :include_discussion => true }
     assert_response :success, "cannot get first changeset with comments"
 
     assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
@@ -175,7 +175,7 @@ class ChangesetsControllerTest < ActionController::TestCase
     changeset_id = create(:changeset, :closed).id
     create_list(:changeset_comment, 3, :changeset_id => changeset_id)
 
-    get :read, :params => { :id => changeset_id, :include_discussion => true }
+    get :show, :params => { :id => changeset_id, :include_discussion => true }
     assert_response :success, "cannot get closed changeset with comments"
 
     assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
@@ -186,10 +186,10 @@ class ChangesetsControllerTest < ActionController::TestCase
 
   ##
   # check that a changeset that doesn't exist returns an appropriate message
-  def test_read_not_found
+  def test_show_not_found
     [0, -32, 233455644, "afg", "213"].each do |id|
       begin
-        get :read, :params => { :id => id }
+        get :show, :params => { :id => id }
         assert_response :not_found, "should get a not found"
       rescue ActionController::UrlGenerationError => ex
         assert_match(/No route matches/, ex.to_s)
@@ -1483,7 +1483,7 @@ CHANGESET
     end
 
     # get the bounding box back from the changeset
-    get :read, :params => { :id => changeset_id }
+    get :show, :params => { :id => changeset_id }
     assert_response :success, "Couldn't read back changeset."
     assert_select "osm>changeset[min_lon='1.0000000']", 1
     assert_select "osm>changeset[max_lon='1.0000000']", 1
@@ -1498,7 +1498,7 @@ CHANGESET
     end
 
     # get the bounding box back from the changeset
-    get :read, :params => { :id => changeset_id }
+    get :show, :params => { :id => changeset_id }
     assert_response :success, "Couldn't read back changeset for the second time."
     assert_select "osm>changeset[min_lon='1.0000000']", 1
     assert_select "osm>changeset[max_lon='2.0000000']", 1
@@ -1513,7 +1513,7 @@ CHANGESET
     end
 
     # get the bounding box back from the changeset
-    get :read, :params => { :id => changeset_id }
+    get :show, :params => { :id => changeset_id }
     assert_response :success, "Couldn't read back changeset for the third time."
     assert_select "osm>changeset[min_lon='1.0000000']", 1
     assert_select "osm>changeset[max_lon='3.0000000']", 1
@@ -1789,7 +1789,7 @@ CHANGESET
       assert_response :success, "can't create a new node"
       node_id = @response.body.to_i
 
-      get :read, :params => { :id => node_id }
+      get :show, :params => { :id => node_id }
       assert_response :success, "can't read back new node"
       node_doc = XML::Parser.string(@response.body).parse
       node_xml = node_doc.find("//osm/node").first
index 77a6d372b6c52f9fa7063d87d2b0f65694b36c91..e63f04e1196306fdaf7c012c5c1cd1820accedec 100644 (file)
@@ -10,7 +10,7 @@ class NodesControllerTest < ActionController::TestCase
     )
     assert_routing(
       { :path => "/api/0.6/node/1", :method => :get },
-      { :controller => "nodes", :action => "read", :id => "1" }
+      { :controller => "nodes", :action => "show", :id => "1" }
     )
     assert_routing(
       { :path => "/api/0.6/node/1", :method => :put },
@@ -22,7 +22,7 @@ class NodesControllerTest < ActionController::TestCase
     )
     assert_routing(
       { :path => "/api/0.6/nodes", :method => :get },
-      { :controller => "nodes", :action => "nodes" }
+      { :controller => "nodes", :action => "index" }
     )
   end
 
@@ -132,17 +132,17 @@ class NodesControllerTest < ActionController::TestCase
     assert_equal ["NodeTag ", " v: is too long (maximum is 255 characters) (\"#{'x' * 256}\")"], @response.body.split(/[0-9]+,foo:/)
   end
 
-  def test_read
+  def test_show
     # check that a visible node is returned properly
-    get :read, :params => { :id => create(:node).id }
+    get :show, :params => { :id => create(:node).id }
     assert_response :success
 
     # check that an deleted node is not returned
-    get :read, :params => { :id => create(:node, :deleted).id }
+    get :show, :params => { :id => create(:node, :deleted).id }
     assert_response :gone
 
     # check chat a non-existent node is not returned
-    get :read, :params => { :id => 0 }
+    get :show, :params => { :id => 0 }
     assert_response :not_found
   end
 
@@ -427,7 +427,7 @@ class NodesControllerTest < ActionController::TestCase
 
   ##
   # test fetching multiple nodes
-  def test_nodes
+  def test_index
     node1 = create(:node)
     node2 = create(:node, :deleted)
     node3 = create(:node)
@@ -435,15 +435,15 @@ class NodesControllerTest < ActionController::TestCase
     node5 = create(:node, :deleted, :with_history, :version => 2)
 
     # check error when no parameter provided
-    get :nodes
+    get :index
     assert_response :bad_request
 
     # check error when no parameter value provided
-    get :nodes, :params => { :nodes => "" }
+    get :index, :params => { :nodes => "" }
     assert_response :bad_request
 
     # test a working call
-    get :nodes, :params => { :nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id}" }
+    get :index, :params => { :nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id}" }
     assert_response :success
     assert_select "osm" do
       assert_select "node", :count => 5
@@ -455,7 +455,7 @@ class NodesControllerTest < ActionController::TestCase
     end
 
     # check error when a non-existent node is included
-    get :nodes, :params => { :nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id},0" }
+    get :index, :params => { :nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id},0" }
     assert_response :not_found
   end
 
@@ -518,7 +518,7 @@ class NodesControllerTest < ActionController::TestCase
     assert_not_nil checknode, "node not found in data base after upload"
 
     # and grab it using the api
-    get :read, :params => { :id => nodeid }
+    get :show, :params => { :id => nodeid }
     assert_response :success
     apinode = Node.from_xml(@response.body)
     assert_not_nil apinode, "downloaded node is nil, but shouldn't be"
index 53c5072340f77607ccdce89227284ce49659c41c..94d16c8c059d12b4469c12e044c83390995e28cb 100644 (file)
@@ -386,7 +386,7 @@ class OldNodesControllerTest < ActionController::TestCase
   def check_current_version(node_id)
     # get the current version of the node
     current_node = with_controller(NodesController.new) do
-      get :read, :params => { :id => node_id }
+      get :show, :params => { :id => node_id }
       assert_response :success, "cant get current node #{node_id}"
       Node.from_xml(@response.body)
     end
index 51e6c565a315d936a50e0684610517cab1d7b834..9dd9a7165abcf60755a1c99cbd25500fbecb6a36 100644 (file)
@@ -225,7 +225,7 @@ class OldRelationsControllerTest < ActionController::TestCase
   def check_current_version(relation_id)
     # get the current version
     current_relation = with_controller(RelationsController.new) do
-      get :read, :params => { :id => relation_id }
+      get :show, :params => { :id => relation_id }
       assert_response :success, "can't get current relation #{relation_id}"
       Relation.from_xml(@response.body)
     end
index 0dd2d5e3c743ed20422d4dc771da137917e16671..737ca1faf7662176f0fbf883d9c4356706b84169 100644 (file)
@@ -265,7 +265,7 @@ class OldWaysControllerTest < ActionController::TestCase
   def check_current_version(way_id)
     # get the current version
     current_way = with_controller(WaysController.new) do
-      get :read, :params => { :id => way_id }
+      get :show, :params => { :id => way_id }
       assert_response :success, "can't get current way #{way_id}"
       Way.from_xml(@response.body)
     end
index fe35637bdfbf21613907b908d5906b1c18c3f045..a8b0ed2dffed80eddddb8c059453fa18dfac471d 100644 (file)
@@ -14,7 +14,7 @@ class RelationsControllerTest < ActionController::TestCase
     )
     assert_routing(
       { :path => "/api/0.6/relation/1", :method => :get },
-      { :controller => "relations", :action => "read", :id => "1" }
+      { :controller => "relations", :action => "show", :id => "1" }
     )
     assert_routing(
       { :path => "/api/0.6/relation/1", :method => :put },
@@ -26,7 +26,7 @@ class RelationsControllerTest < ActionController::TestCase
     )
     assert_routing(
       { :path => "/api/0.6/relations", :method => :get },
-      { :controller => "relations", :action => "relations" }
+      { :controller => "relations", :action => "index" }
     )
 
     assert_routing(
@@ -44,20 +44,20 @@ class RelationsControllerTest < ActionController::TestCase
   end
 
   # -------------------------------------
-  # Test reading relations.
+  # Test showing relations.
   # -------------------------------------
 
-  def test_read
+  def test_show
     # check that a visible relation is returned properly
-    get :read, :params => { :id => create(:relation).id }
+    get :show, :params => { :id => create(:relation).id }
     assert_response :success
 
     # check that an invisible relation is not returned
-    get :read, :params => { :id => create(:relation, :deleted).id }
+    get :show, :params => { :id => create(:relation, :deleted).id }
     assert_response :gone
 
     # check chat a non-existent relation is not returned
-    get :read, :params => { :id => 0 }
+    get :show, :params => { :id => 0 }
     assert_response :not_found
   end
 
@@ -160,7 +160,7 @@ class RelationsControllerTest < ActionController::TestCase
 
   ##
   # test fetching multiple relations
-  def test_relations
+  def test_index
     relation1 = create(:relation)
     relation2 = create(:relation, :deleted)
     relation3 = create(:relation, :with_history, :version => 2)
@@ -168,15 +168,15 @@ class RelationsControllerTest < ActionController::TestCase
     relation4.old_relations.find_by(:version => 1).redact!(create(:redaction))
 
     # check error when no parameter provided
-    get :relations
+    get :index
     assert_response :bad_request
 
     # check error when no parameter value provided
-    get :relations, :params => { :relations => "" }
+    get :index, :params => { :relations => "" }
     assert_response :bad_request
 
     # test a working call
-    get :relations, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}" }
+    get :index, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}" }
     assert_response :success
     assert_select "osm" do
       assert_select "relation", :count => 4
@@ -187,7 +187,7 @@ class RelationsControllerTest < ActionController::TestCase
     end
 
     # check error when a non-existent relation is included
-    get :relations, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id},0" }
+    get :index, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id},0" }
     assert_response :not_found
   end
 
@@ -270,7 +270,7 @@ class RelationsControllerTest < ActionController::TestCase
     assert_equal true, checkrelation.visible,
                  "saved relation is not visible"
     # ok the relation is there but can we also retrieve it?
-    get :read, :params => { :id => relationid }
+    get :show, :params => { :id => relationid }
     assert_response :success
 
     ###
@@ -301,7 +301,7 @@ class RelationsControllerTest < ActionController::TestCase
                  "saved relation is not visible"
     # ok the relation is there but can we also retrieve it?
 
-    get :read, :params => { :id => relationid }
+    get :show, :params => { :id => relationid }
     assert_response :success
 
     ###
@@ -331,7 +331,7 @@ class RelationsControllerTest < ActionController::TestCase
                  "saved relation is not visible"
     # ok the relation is there but can we also retrieve it?
 
-    get :read, :params => { :id => relationid }
+    get :show, :params => { :id => relationid }
     assert_response :success
 
     ###
@@ -361,7 +361,7 @@ class RelationsControllerTest < ActionController::TestCase
     assert_equal true, checkrelation.visible,
                  "saved relation is not visible"
     # ok the relation is there but can we also retrieve it?
-    get :read, :params => { :id => relationid }
+    get :show, :params => { :id => relationid }
     assert_response :success
   end
 
@@ -690,7 +690,7 @@ class RelationsControllerTest < ActionController::TestCase
         assert_response :success, "can't update relation for add #{element.class}/bbox test: #{@response.body}"
 
         # get it back and check the ordering
-        get :read, :params => { :id => relation.id }
+        get :show, :params => { :id => relation.id }
         assert_response :success, "can't read back the relation: #{@response.body}"
         check_ordering(relation_xml, @response.body)
       end
@@ -753,7 +753,7 @@ OSM
     relation_id = @response.body.to_i
 
     # get it back and check the ordering
-    get :read, :params => { :id => relation_id }
+    get :show, :params => { :id => relation_id }
     assert_response :success, "can't read back the relation: #{@response.body}"
     check_ordering(doc, @response.body)
 
@@ -773,7 +773,7 @@ OSM
     assert_equal 2, @response.body.to_i
 
     # get it back again and check the ordering again
-    get :read, :params => { :id => relation_id }
+    get :show, :params => { :id => relation_id }
     assert_response :success, "can't read back the relation: #{@response.body}"
     check_ordering(doc, @response.body)
 
@@ -820,7 +820,7 @@ OSM
     relation_id = @response.body.to_i
 
     # get it back and check the ordering
-    get :read, :params => { :id => relation_id }
+    get :show, :params => { :id => relation_id }
     assert_response :success, "can't read back the relation: #{relation_id}"
     check_ordering(doc, @response.body)
   end
@@ -853,7 +853,7 @@ OSM
     relation_id = @response.body.to_i
 
     # check the ordering in the current tables:
-    get :read, :params => { :id => relation_id }
+    get :show, :params => { :id => relation_id }
     assert_response :success, "can't read back the relation: #{@response.body}"
     check_ordering(doc, @response.body)
 
@@ -952,7 +952,7 @@ OSM
 
     # now download the changeset to check its bounding box
     with_controller(ChangesetsController.new) do
-      get :read, :params => { :id => changeset_id }
+      get :show, :params => { :id => changeset_id }
       assert_response :success, "can't re-read changeset for modify test"
       assert_select "osm>changeset", 1, "Changeset element doesn't exist in #{@response.body}"
       assert_select "osm>changeset[id='#{changeset_id}']", 1, "Changeset id=#{changeset_id} doesn't exist in #{@response.body}"
@@ -969,7 +969,7 @@ OSM
   # doc is returned.
   def with_relation(id, ver = nil)
     if ver.nil?
-      get :read, :params => { :id => id }
+      get :show, :params => { :id => id }
     else
       with_controller(OldRelationsController.new) do
         get :version, :params => { :id => id, :version => ver }
@@ -990,7 +990,7 @@ OSM
     version = @response.body.to_i
 
     # now get the new version
-    get :read, :params => { :id => rel_id }
+    get :show, :params => { :id => rel_id }
     assert_response :success
     new_rel = xml_parse(@response.body)
 
@@ -1022,7 +1022,7 @@ OSM
     end
 
     # now get the new version
-    get :read, :params => { :id => rel_id }
+    get :show, :params => { :id => rel_id }
     assert_response :success
     new_rel = xml_parse(@response.body)
 
index 091ce18c4ce299b684c57be43a3161a00e3f7fd0..3c141dce09b5783159b2e265e4923bd3df1e22aa 100644 (file)
@@ -14,7 +14,7 @@ class WaysControllerTest < ActionController::TestCase
     )
     assert_routing(
       { :path => "/api/0.6/way/1", :method => :get },
-      { :controller => "ways", :action => "read", :id => "1" }
+      { :controller => "ways", :action => "show", :id => "1" }
     )
     assert_routing(
       { :path => "/api/0.6/way/1", :method => :put },
@@ -26,25 +26,25 @@ class WaysControllerTest < ActionController::TestCase
     )
     assert_routing(
       { :path => "/api/0.6/ways", :method => :get },
-      { :controller => "ways", :action => "ways" }
+      { :controller => "ways", :action => "index" }
     )
   end
 
   # -------------------------------------
-  # Test reading ways.
+  # Test showing ways.
   # -------------------------------------
 
-  def test_read
+  def test_show
     # check that a visible way is returned properly
-    get :read, :params => { :id => create(:way).id }
+    get :show, :params => { :id => create(:way).id }
     assert_response :success
 
     # check that an invisible way is not returned
-    get :read, :params => { :id => create(:way, :deleted).id }
+    get :show, :params => { :id => create(:way, :deleted).id }
     assert_response :gone
 
     # check chat a non-existent way is not returned
-    get :read, :params => { :id => 0 }
+    get :show, :params => { :id => 0 }
     assert_response :not_found
   end
 
@@ -78,22 +78,22 @@ class WaysControllerTest < ActionController::TestCase
 
   ##
   # test fetching multiple ways
-  def test_ways
+  def test_index
     way1 = create(:way)
     way2 = create(:way, :deleted)
     way3 = create(:way)
     way4 = create(:way)
 
     # check error when no parameter provided
-    get :ways
+    get :index
     assert_response :bad_request
 
     # check error when no parameter value provided
-    get :ways, :params => { :ways => "" }
+    get :index, :params => { :ways => "" }
     assert_response :bad_request
 
     # test a working call
-    get :ways, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id}" }
+    get :index, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id}" }
     assert_response :success
     assert_select "osm" do
       assert_select "way", :count => 4
@@ -104,7 +104,7 @@ class WaysControllerTest < ActionController::TestCase
     end
 
     # check error when a non-existent way is included
-    get :ways, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id},0" }
+    get :index, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id},0" }
     assert_response :not_found
   end