From f6363915806033a3d54c39b6ca5e368d828d6c26 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 23 Oct 2014 21:40:13 +0100 Subject: [PATCH] Move changeset comment feeds out of the API namespace --- config/routes.rb | 3 +- test/controllers/changeset_controller_test.rb | 36 +++++++++---------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 789c22c9b..8cbf8f900 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,7 +15,6 @@ OpenStreetMap::Application.routes.draw do match 'api/0.6/changeset/:id/close' => 'changeset#close', :via => :put, :id => /\d+/ match 'api/0.6/changesets' => 'changeset#query', :via => :get post 'api/0.6/changeset/:id/comment' => 'changeset#comment', :as => :changeset_comment, :id => /\d+/ - get 'api/0.6/changeset(/:id)/comments/feed' => 'changeset#comments_feed', :as => :changeset_comments_feed, :id => /\d*/, :defaults => { :format => 'rss' } post 'api/0.6/changeset/comment/:id/hide' => 'changeset#hide_comment', :as => :changeset_comment_hide, :id => /\d+/ post 'api/0.6/changeset/comment/:id/unhide' => 'changeset#unhide_comment', :as => :changeset_comment_unhide, :id => /\d+/ @@ -115,6 +114,7 @@ OpenStreetMap::Application.routes.draw do match '/relation/:id' => 'browse#relation', :via => :get, :id => /\d+/, :as => :relation match '/relation/:id/history' => 'browse#relation_history', :via => :get, :id => /\d+/ match '/changeset/:id' => 'browse#changeset', :via => :get, :as => :changeset, :id => /\d+/ + match '/changeset/:id/comments/feed' => 'changeset#comments_feed', :via => :get, :as => :changeset_comments_feed, :id => /\d*/, :defaults => { :format => 'rss' } match '/note/:id' => 'browse#note', :via => :get, :id => /\d+/, :as => "browse_note" match '/note/new' => 'browse#new_note', :via => :get match '/user/:display_name/history' => 'changeset#list', :via => :get @@ -150,6 +150,7 @@ OpenStreetMap::Application.routes.draw do match '/about' => 'site#about', :via => :get, :as => :about match '/history' => 'changeset#list', :via => :get match '/history/feed' => 'changeset#feed', :via => :get, :defaults => { :format => :atom } + match '/history/comments/feed' => 'changeset#comments_feed', :via => :get, :as => :changesets_comments_feed, :defaults => { :format => 'rss' } match '/export' => 'site#export', :via => :get match '/login' => 'user#login', :via => [:get, :post] match '/logout' => 'user#logout', :via => [:get, :post] diff --git a/test/controllers/changeset_controller_test.rb b/test/controllers/changeset_controller_test.rb index e4c2903e0..461738330 100644 --- a/test/controllers/changeset_controller_test.rb +++ b/test/controllers/changeset_controller_test.rb @@ -29,12 +29,12 @@ class ChangesetControllerTest < ActionController::TestCase { :controller => "changeset", :action => "read", :id => "1" } ) assert_routing( - { :path => "/api/0.6/changeset/1/subscribe", :method => :post }, - { :controller => "changeset", :action => "subscribe", :id => "1" } + { :path => "/api/0.6/changeset/1/subscribe", :method => :post }, + { :controller => "changeset", :action => "subscribe", :id => "1" } ) assert_routing( - { :path => "/api/0.6/changeset/1/unsubscribe", :method => :post }, - { :controller => "changeset", :action => "unsubscribe", :id => "1" } + { :path => "/api/0.6/changeset/1/unsubscribe", :method => :post }, + { :controller => "changeset", :action => "unsubscribe", :id => "1" } ) assert_routing( { :path => "/api/0.6/changeset/1", :method => :put }, @@ -45,29 +45,25 @@ class ChangesetControllerTest < ActionController::TestCase { :controller => "changeset", :action => "close", :id => "1" } ) assert_routing( - { :path => "/api/0.6/changeset/1/comment", :method => :post }, - { :controller => "changeset", :action => "comment", :id => "1" } + { :path => "/api/0.6/changeset/1/comment", :method => :post }, + { :controller => "changeset", :action => "comment", :id => "1" } ) assert_routing( - { :path => "/api/0.6/changeset/comments/feed", :method => :get }, - { :controller => "changeset", :action => "comments_feed", :format =>"rss" } + { :path => "/api/0.6/changeset/comment/1/hide", :method => :post }, + { :controller => "changeset", :action => "hide_comment", :id => "1" } ) assert_routing( - { :path => "/api/0.6/changeset/1/comments/feed", :method => :get }, - { :controller => "changeset", :action => "comments_feed", :id => "1", :format =>"rss" } - ) - assert_routing( - { :path => "/api/0.6/changeset/comment/1/hide", :method => :post }, - { :controller => "changeset", :action => "hide_comment", :id => "1" } - ) - assert_routing( - { :path => "/api/0.6/changeset/comment/1/unhide", :method => :post }, - { :controller => "changeset", :action => "unhide_comment", :id => "1" } + { :path => "/api/0.6/changeset/comment/1/unhide", :method => :post }, + { :controller => "changeset", :action => "unhide_comment", :id => "1" } ) assert_routing( { :path => "/api/0.6/changesets", :method => :get }, { :controller => "changeset", :action => "query" } ) + assert_routing( + { :path => "/changeset/1/comments/feed", :method => :get }, + { :controller => "changeset", :action => "comments_feed", :id => "1", :format =>"rss" } + ) assert_routing( { :path => "/user/name/history", :method => :get }, { :controller => "changeset", :action => "list", :display_name => "name" } @@ -92,6 +88,10 @@ class ChangesetControllerTest < ActionController::TestCase { :path => "/history/feed", :method => :get }, { :controller => "changeset", :action => "feed", :format => :atom } ) + assert_routing( + { :path => "/history/comments/feed", :method => :get }, + { :controller => "changeset", :action => "comments_feed", :format =>"rss" } + ) end # ----------------------- -- 2.43.2