X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/b01261760893de04dda650a427ceb59beea80004..90e46a58de583ac2bd7bb43077faa94186957a7a:/test/functional/diary_entry_controller_test.rb?ds=sidebyside diff --git a/test/functional/diary_entry_controller_test.rb b/test/functional/diary_entry_controller_test.rb index 738fbe671..54b4cdf7e 100644 --- a/test/functional/diary_entry_controller_test.rb +++ b/test/functional/diary_entry_controller_test.rb @@ -5,6 +5,86 @@ class DiaryEntryControllerTest < ActionController::TestCase include ActionView::Helpers::NumberHelper + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/diary", :method => :get }, + { :controller => "diary_entry", :action => "list" } + ) + assert_routing( + { :path => "/diary/language", :method => :get }, + { :controller => "diary_entry", :action => "list", :language => "language" } + ) + assert_routing( + { :path => "/user/username/diary", :method => :get }, + { :controller => "diary_entry", :action => "list", :display_name => "username" } + ) + assert_routing( + { :path => "/diary/friends", :method => :get }, + { :controller => "diary_entry", :action => "list", :friends => true } + ) + assert_routing( + { :path => "/diary/nearby", :method => :get }, + { :controller => "diary_entry", :action => "list", :nearby => true } + ) + + assert_routing( + { :path => "/diary/rss", :method => :get }, + { :controller => "diary_entry", :action => "rss", :format => :rss } + ) + assert_routing( + { :path => "/diary/language/rss", :method => :get }, + { :controller => "diary_entry", :action => "rss", :language => "language", :format => :rss } + ) + assert_routing( + { :path => "/user/username/diary/rss", :method => :get }, + { :controller => "diary_entry", :action => "rss", :display_name => "username", :format => :rss } + ) + + assert_routing( + { :path => "/user/username/diary/comments", :method => :get }, + { :controller => "diary_entry", :action => "comments", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/diary/comments/1", :method => :get }, + { :controller => "diary_entry", :action => "comments", :display_name => "username", :page => "1" } + ) + + assert_routing( + { :path => "/diary/new", :method => :get }, + { :controller => "diary_entry", :action => "new" } + ) + assert_routing( + { :path => "/diary/new", :method => :post }, + { :controller => "diary_entry", :action => "new" } + ) + assert_routing( + { :path => "/user/username/diary/1", :method => :get }, + { :controller => "diary_entry", :action => "view", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/diary/1/edit", :method => :get }, + { :controller => "diary_entry", :action => "edit", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/diary/1/edit", :method => :post }, + { :controller => "diary_entry", :action => "edit", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/diary/1/newcomment", :method => :post }, + { :controller => "diary_entry", :action => "comment", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/diary/1/hide", :method => :post }, + { :controller => "diary_entry", :action => "hide", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/diary/1/hidecomment/2", :method => :post }, + { :controller => "diary_entry", :action => "hidecomment", :display_name => "username", :id => "1", :comment => "2" } + ) + end + def test_showing_new_diary_entry @request.cookies["_osm_username"] = users(:normal_user).display_name