Skip to content

Commit

Permalink
Add changeset comments controller index test
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Dec 20, 2024
1 parent 1603cef commit cd0d0d0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/controllers/changeset_comments_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cd0d0d0

Please sign in to comment.