X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/e2f1d0d4c2f50b1411b1bfb07d4c3d89992401c6..8e21e4e80156a1fc29d7b283b254ff623ca844b6:/test/controllers/changesets_controller_test.rb diff --git a/test/controllers/changesets_controller_test.rb b/test/controllers/changesets_controller_test.rb index 577ee8fbf..dba7642c4 100644 --- a/test/controllers/changesets_controller_test.rb +++ b/test/controllers/changesets_controller_test.rb @@ -254,6 +254,20 @@ class ChangesetsControllerTest < ActionDispatch::IntegrationTest check_feed_result([closed_changeset, changeset]) end + ## + # This should correctly escape XML special characters in the comment + def test_feed_with_comment_tag + changeset = create(:changeset, :num_changes => 1) + create(:changeset_tag, :changeset => changeset, :k => "comment", :v => "testedcomment") + + 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 +343,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