X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/6f71b372fb1289e3733f9dbd929fd18efe850b13..ef648a53bab7620021c2cc371caf105a1a6a6bcc:/test/controllers/diary_comments_controller_test.rb?ds=sidebyside diff --git a/test/controllers/diary_comments_controller_test.rb b/test/controllers/diary_comments_controller_test.rb index 51ebe048c..a516bde8d 100644 --- a/test/controllers/diary_comments_controller_test.rb +++ b/test/controllers/diary_comments_controller_test.rb @@ -8,10 +8,6 @@ class DiaryCommentsControllerTest < ActionDispatch::IntegrationTest end def test_routes - assert_routing( - { :path => "/user/username/diary_comments", :method => :get }, - { :controller => "diary_comments", :action => "index", :display_name => "username" } - ) assert_routing( { :path => "/user/username/diary/1/comments", :method => :post }, { :controller => "diary_comments", :action => "create", :display_name => "username", :id => "1" } @@ -24,56 +20,6 @@ class DiaryCommentsControllerTest < ActionDispatch::IntegrationTest { :path => "/diary_comments/2/unhide", :method => :post }, { :controller => "diary_comments", :action => "unhide", :comment => "2" } ) - - get "/user/username/diary/comments/1" - assert_redirected_to "/user/username/diary_comments" - - get "/user/username/diary/comments" - assert_redirected_to "/user/username/diary_comments" - end - - def test_index - user = create(:user) - other_user = create(:user) - suspended_user = create(:user, :suspended) - deleted_user = create(:user, :deleted) - - # Test a user with no comments - get user_diary_comments_path(user) - assert_response :success - assert_template :index - assert_select "h4", :html => "No diary comments" - - # Test a user with a comment - create(:diary_comment, :user => other_user) - - get user_diary_comments_path(other_user) - assert_response :success - assert_template :index - assert_dom "a[href='#{user_path(other_user)}']", :text => other_user.display_name - assert_select "table.table-striped tbody" do - assert_select "tr", :count => 1 - end - - # Test a suspended user - get user_diary_comments_path(suspended_user) - assert_response :not_found - - # Test a deleted user - get user_diary_comments_path(deleted_user) - assert_response :not_found - end - - def test_index_invalid_paged - user = create(:user) - - %w[-1 0 fred].each do |id| - get user_diary_comments_path(user, :before => id) - assert_redirected_to :controller => :errors, :action => :bad_request - - get user_diary_comments_path(user, :after => id) - assert_redirected_to :controller => :errors, :action => :bad_request - end end def test_create