+ ##
+ # test all routes which lead to this controller
+ def test_routes
+ assert_routing(
+ { :path => "/api/0.6/notes", :method => :post },
+ { :controller => "notes", :action => "create", :format => "xml" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/notes/1", :method => :get },
+ { :controller => "notes", :action => "show", :id => "1", :format => "xml" }
+ )
+ assert_recognizes(
+ { :controller => "notes", :action => "show", :id => "1", :format => "xml" },
+ { :path => "/api/0.6/notes/1.xml", :method => :get }
+ )
+ assert_routing(
+ { :path => "/api/0.6/notes/1.rss", :method => :get },
+ { :controller => "notes", :action => "show", :id => "1", :format => "rss" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/notes/1.json", :method => :get },
+ { :controller => "notes", :action => "show", :id => "1", :format => "json" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/notes/1.gpx", :method => :get },
+ { :controller => "notes", :action => "show", :id => "1", :format => "gpx" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/notes/1/comment", :method => :post },
+ { :controller => "notes", :action => "comment", :id => "1", :format => "xml" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/notes/1/close", :method => :post },
+ { :controller => "notes", :action => "close", :id => "1", :format => "xml" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/notes/1", :method => :delete },
+ { :controller => "notes", :action => "destroy", :id => "1", :format => "xml" }
+ )
+
+ assert_routing(
+ { :path => "/api/0.6/notes", :method => :get },
+ { :controller => "notes", :action => "index", :format => "xml" }
+ )
+ assert_recognizes(
+ { :controller => "notes", :action => "index", :format => "xml" },
+ { :path => "/api/0.6/notes.xml", :method => :get }
+ )
+ assert_routing(
+ { :path => "/api/0.6/notes.rss", :method => :get },
+ { :controller => "notes", :action => "index", :format => "rss" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/notes.json", :method => :get },
+ { :controller => "notes", :action => "index", :format => "json" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/notes.gpx", :method => :get },
+ { :controller => "notes", :action => "index", :format => "gpx" }
+ )
+
+ assert_routing(
+ { :path => "/api/0.6/notes/search", :method => :get },
+ { :controller => "notes", :action => "search", :format => "xml" }
+ )
+ assert_recognizes(
+ { :controller => "notes", :action => "search", :format => "xml" },
+ { :path => "/api/0.6/notes/search.xml", :method => :get }
+ )
+ assert_routing(
+ { :path => "/api/0.6/notes/search.rss", :method => :get },
+ { :controller => "notes", :action => "search", :format => "rss" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/notes/search.json", :method => :get },
+ { :controller => "notes", :action => "search", :format => "json" }
+ )
+ assert_routing(
+ { :path => "/api/0.6/notes/search.gpx", :method => :get },
+ { :controller => "notes", :action => "search", :format => "gpx" }
+ )
+
+ assert_routing(
+ { :path => "/api/0.6/notes/feed", :method => :get },
+ { :controller => "notes", :action => "feed", :format => "rss" }
+ )
+
+ assert_recognizes(
+ { :controller => "notes", :action => "create" },
+ { :path => "/api/0.6/notes/addPOIexec", :method => :post }
+ )
+ assert_recognizes(
+ { :controller => "notes", :action => "close" },
+ { :path => "/api/0.6/notes/closePOIexec", :method => :post }
+ )
+ assert_recognizes(
+ { :controller => "notes", :action => "comment" },
+ { :path => "/api/0.6/notes/editPOIexec", :method => :post }
+ )
+ assert_recognizes(
+ { :controller => "notes", :action => "index", :format => "gpx" },
+ { :path => "/api/0.6/notes/getGPX", :method => :get }
+ )
+ assert_recognizes(
+ { :controller => "notes", :action => "feed", :format => "rss" },
+ { :path => "/api/0.6/notes/getRSSfeed", :method => :get }
+ )
+
+ assert_routing(
+ { :path => "/user/username/notes", :method => :get },
+ { :controller => "notes", :action => "mine", :display_name => "username" }
+ )
+ end
+