From dc07462c3b13838162f2a7c9d9c7521ba1be6e54 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Fri, 16 Feb 2024 20:05:25 +0300 Subject: [PATCH] Test changeset feed entry titles --- .../controllers/changesets_controller_test.rb | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/controllers/changesets_controller_test.rb b/test/controllers/changesets_controller_test.rb index 577ee8fbf..778a6024c 100644 --- a/test/controllers/changesets_controller_test.rb +++ b/test/controllers/changesets_controller_test.rb @@ -254,6 +254,18 @@ class ChangesetsControllerTest < ActionDispatch::IntegrationTest check_feed_result([closed_changeset, changeset]) end + def test_feed_with_comment_tag + changeset = create(:changeset, :num_changes => 1) + create(:changeset_tag, :changeset => changeset, :k => "comment", :v => "tested-changeset-comment") + + get history_feed_path(:format => :atom) + assert_response :success + assert_template "index" + assert_equal "application/atom+xml", response.media_type + + check_feed_result([changeset]) + end + ## # This should display the last 20 changesets closed in a specific area def test_feed_bbox @@ -329,6 +341,14 @@ class ChangesetsControllerTest < ActionDispatch::IntegrationTest assert_select "> entry", :count => changesets.size do |entries| entries.zip(changesets) do |entry, changeset| assert_select entry, "> id", :text => changeset_url(:id => changeset.id) + + changeset_comment = changeset.tags["comment"] + if changeset_comment + assert_select entry, "> title", :count => 1, :text => "Changeset #{changeset.id} - #{changeset_comment}" + else + assert_select entry, "> title", :count => 1, :text => "Changeset #{changeset.id}" + end + assert_select entry, "> content > xhtml|div > xhtml|table" do if changeset.tags.empty? assert_select "> xhtml|tr > xhtml|td > xhtml|table", :count => 0 -- 2.39.5