From 2b8798d769f273ae11b5da902c0879cbc15c0072 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Mon, 8 Jan 2024 16:14:15 +0300 Subject: [PATCH] Remove hidden comments test from controller tests --- app/views/browse/changeset.html.erb | 64 +++++++++++----------- test/controllers/browse_controller_test.rb | 14 ----- 2 files changed, 31 insertions(+), 47 deletions(-) diff --git a/app/views/browse/changeset.html.erb b/app/views/browse/changeset.html.erb index 1190423f6..ef30f8214 100644 --- a/app/views/browse/changeset.html.erb +++ b/app/views/browse/changeset.html.erb @@ -27,41 +27,39 @@ <% if @comments.length > 0 %> -
-
-
    - <% @comments.each do |comment| %> - <% if comment.visible %> -
  • - - <%= t(".comment_by_html", - :time_ago => friendly_date_ago(comment.created_at), - :user => link_to(comment.author.display_name, user_path(comment.author))) %> - <% if current_user and current_user.moderator? %> - — - <% end %> + +
      + <% @comments.each do |comment| %> + <% if comment.visible %> +
    • + + <%= t(".comment_by_html", + :time_ago => friendly_date_ago(comment.created_at), + :user => link_to(comment.author.display_name, user_path(comment.author))) %> + <% if current_user and current_user.moderator? %> + — + <% end %> + +
      + <%= comment.body.to_html %> +
      +
    • + <% elsif current_user and current_user.moderator? %> +
    • + + <%= t(".hidden_comment_by_html", + :time_ago => friendly_date_ago(comment.created_at), + :user => link_to(comment.author.display_name, user_path(comment.author))) %> + — -
      - <%= comment.body.to_html %> -
      -
    • - <% elsif current_user and current_user.moderator? %> -
    • - - <%= t(".hidden_comment_by_html", - :time_ago => friendly_date_ago(comment.created_at), - :user => link_to(comment.author.display_name, user_path(comment.author))) %> - — - -
      - <%= comment.body.to_html %> -
      -
    • - <% end %> +
      + <%= comment.body.to_html %> +
      + <% end %> -
    - -
+ <% end %> + + <% end %> <% unless current_user %> diff --git a/test/controllers/browse_controller_test.rb b/test/controllers/browse_controller_test.rb index 7df246c57..0709d544e 100644 --- a/test/controllers/browse_controller_test.rb +++ b/test/controllers/browse_controller_test.rb @@ -142,20 +142,6 @@ class BrowseControllerTest < ActionDispatch::IntegrationTest browse_check :changeset_path, changeset.id, "browse/changeset" end - def test_read_changeset_hidden_comments - changeset = create(:changeset) - create_list(:changeset_comment, 3, :changeset => changeset) - create(:changeset_comment, :visible => false, :changeset => changeset) - - browse_check :changeset_path, changeset.id, "browse/changeset" - assert_select "div.changeset-comments ul li", :count => 3 - - session_for(create(:moderator_user)) - - browse_check :changeset_path, changeset.id, "browse/changeset" - assert_select "div.changeset-comments ul li", :count => 4 - end - ## # Methods to check redaction. # -- 2.39.5