From cd0d0d086f74de58a59df8087d0050d909315ba0 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Thu, 14 Sep 2023 17:30:35 +0300 Subject: [PATCH] Add changeset comments controller index test --- .../changeset_comments_controller_test.rb | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/controllers/changeset_comments_controller_test.rb b/test/controllers/changeset_comments_controller_test.rb index c1d610f384..2bc1675b10 100644 --- a/test/controllers/changeset_comments_controller_test.rb +++ b/test/controllers/changeset_comments_controller_test.rb @@ -9,4 +9,29 @@ def test_routes { :controller => "changeset_comments", :action => "index", :display_name => "name" } ) end + + ## + # test comments webpage + def test_index + user = create(:user) + other_user = create(:user) + changeset = create(:changeset, :closed) + create_list(:changeset_comment, 3, :changeset => changeset, :author => user) + create_list(:changeset_comment, 2, :changeset => changeset, :author => other_user) + + get changeset_comments_path(user) + assert_response :success + assert_select "table.table-striped tbody" do + assert_select "tr", :count => 3 + end + + create(:changeset_comment, :changeset => changeset, :author => user) + create(:changeset_comment, :changeset => changeset, :author => user, :visible => false) + + get changeset_comments_path(user) + assert_response :success + assert_select "table.table-striped tbody" do + assert_select "tr", :count => 4 + end + end end