Merge remote-tracking branch 'upstream/pull/3714'
This commit is contained in:
commit
db52805f97
3 changed files with 10 additions and 9 deletions
|
@ -9,6 +9,7 @@ module Api
|
||||||
|
|
||||||
before_action :set_locale
|
before_action :set_locale
|
||||||
around_action :api_call_handle_error, :api_call_timeout
|
around_action :api_call_handle_error, :api_call_timeout
|
||||||
|
before_action :set_request_formats, :except => [:feed]
|
||||||
|
|
||||||
##
|
##
|
||||||
# Return a list of notes in a given area
|
# Return a list of notes in a given area
|
||||||
|
|
|
@ -84,7 +84,7 @@ OpenStreetMap::Application.routes.draw do
|
||||||
get "gpx/:id/data" => "api/traces#data", :as => :api_trace_data
|
get "gpx/:id/data" => "api/traces#data", :as => :api_trace_data
|
||||||
|
|
||||||
# Map notes API
|
# Map notes API
|
||||||
resources :notes, :except => [:new, :edit, :update], :constraints => { :id => /\d+/ }, :defaults => { :format => "xml" }, :controller => "api/notes" do
|
resources :notes, :except => [:new, :edit, :update], :constraints => { :id => /\d+/ }, :controller => "api/notes" do
|
||||||
collection do
|
collection do
|
||||||
get "search"
|
get "search"
|
||||||
get "feed", :defaults => { :format => "rss" }
|
get "feed", :defaults => { :format => "rss" }
|
||||||
|
|
|
@ -14,11 +14,11 @@ module Api
|
||||||
def test_routes
|
def test_routes
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/notes", :method => :post },
|
{ :path => "/api/0.6/notes", :method => :post },
|
||||||
{ :controller => "api/notes", :action => "create", :format => "xml" }
|
{ :controller => "api/notes", :action => "create" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/notes/1", :method => :get },
|
{ :path => "/api/0.6/notes/1", :method => :get },
|
||||||
{ :controller => "api/notes", :action => "show", :id => "1", :format => "xml" }
|
{ :controller => "api/notes", :action => "show", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_recognizes(
|
assert_recognizes(
|
||||||
{ :controller => "api/notes", :action => "show", :id => "1", :format => "xml" },
|
{ :controller => "api/notes", :action => "show", :id => "1", :format => "xml" },
|
||||||
|
@ -38,24 +38,24 @@ module Api
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/notes/1/comment", :method => :post },
|
{ :path => "/api/0.6/notes/1/comment", :method => :post },
|
||||||
{ :controller => "api/notes", :action => "comment", :id => "1", :format => "xml" }
|
{ :controller => "api/notes", :action => "comment", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/notes/1/close", :method => :post },
|
{ :path => "/api/0.6/notes/1/close", :method => :post },
|
||||||
{ :controller => "api/notes", :action => "close", :id => "1", :format => "xml" }
|
{ :controller => "api/notes", :action => "close", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/notes/1/reopen", :method => :post },
|
{ :path => "/api/0.6/notes/1/reopen", :method => :post },
|
||||||
{ :controller => "api/notes", :action => "reopen", :id => "1", :format => "xml" }
|
{ :controller => "api/notes", :action => "reopen", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/notes/1", :method => :delete },
|
{ :path => "/api/0.6/notes/1", :method => :delete },
|
||||||
{ :controller => "api/notes", :action => "destroy", :id => "1", :format => "xml" }
|
{ :controller => "api/notes", :action => "destroy", :id => "1" }
|
||||||
)
|
)
|
||||||
|
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/notes", :method => :get },
|
{ :path => "/api/0.6/notes", :method => :get },
|
||||||
{ :controller => "api/notes", :action => "index", :format => "xml" }
|
{ :controller => "api/notes", :action => "index" }
|
||||||
)
|
)
|
||||||
assert_recognizes(
|
assert_recognizes(
|
||||||
{ :controller => "api/notes", :action => "index", :format => "xml" },
|
{ :controller => "api/notes", :action => "index", :format => "xml" },
|
||||||
|
@ -76,7 +76,7 @@ module Api
|
||||||
|
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/notes/search", :method => :get },
|
{ :path => "/api/0.6/notes/search", :method => :get },
|
||||||
{ :controller => "api/notes", :action => "search", :format => "xml" }
|
{ :controller => "api/notes", :action => "search" }
|
||||||
)
|
)
|
||||||
assert_recognizes(
|
assert_recognizes(
|
||||||
{ :controller => "api/notes", :action => "search", :format => "xml" },
|
{ :controller => "api/notes", :action => "search", :format => "xml" },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue