]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/changeset_controller_test.rb
Fix some tests
[rails.git] / test / controllers / changeset_controller_test.rb
index aad27a06dcceccae7ce5c1fe19d25b256060e38d..7d751a5c75f700a37588f7b2d0093d9e70a6700a 100644 (file)
@@ -180,6 +180,7 @@ class ChangesetControllerTest < ActionController::TestCase
   # document structure.
   def test_read
     changeset_id = changesets(:normal_user_first_change).id
+
     get :read, :id => changeset_id
     assert_response :success, "cannot get first changeset"
 
@@ -193,6 +194,17 @@ class ChangesetControllerTest < ActionController::TestCase
     assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
     assert_select "osm>changeset[id='#{changeset_id}']", 1
     assert_select "osm>changeset>discussion", 1
+    assert_select "osm>changeset>discussion>comment", 0
+
+    changeset_id = changesets(:normal_user_closed_change).id
+
+    get :read, :id => changeset_id, :include_discussion => true
+    assert_response :success, "cannot get closed changeset with comments"
+
+    assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1
+    assert_select "osm>changeset[id='#{changeset_id}']", 1
+    assert_select "osm>changeset>discussion", 1
+    assert_select "osm>changeset>discussion>comment", 3
   end
 
   ##
@@ -1381,7 +1393,7 @@ EOF
     assert_response :success
     assert_template nil
     # print @response.body
-    # FIXME needs more assert_select tests
+    # FIXME: needs more assert_select tests
     assert_select "osmChange[version='#{API_VERSION}'][generator='#{GENERATOR}']" do
       assert_select "create", :count => 5
       assert_select "create>node[id='#{nodes(:used_node_2).node_id}'][visible='#{nodes(:used_node_2).visible?}'][version='#{nodes(:used_node_2).version}']" do
@@ -1393,7 +1405,7 @@ EOF
 
   ##
   # check that the bounding box of a changeset gets updated correctly
-  ## FIXME: This should really be moded to a integration test due to the with_controller
+  # FIXME: This should really be moded to a integration test due to the with_controller
   def test_changeset_bbox
     basic_authorization users(:public_user).email, "test"
 
@@ -1769,7 +1781,7 @@ EOF
     # Now check that all 20 (or however many were returned) changesets are in the html
     assert_select "li", :count => changesets.size
     changesets.each do |_changeset|
-      # FIXME this test needs rewriting - test for table contents
+      # FIXME: this test needs rewriting - test for table contents
     end
   end
 
@@ -1795,7 +1807,7 @@ EOF
     # Now check that all 20 (or however many were returned) changesets are in the html
     assert_select "li", :count => changesets.size
     changesets.each do |_changeset|
-      # FIXME this test needs rewriting - test for table contents
+      # FIXME: this test needs rewriting - test for table contents
     end
   end
 
@@ -1806,7 +1818,7 @@ EOF
     get :list, :format => "html", :display_name => user.display_name
     assert_response :success
     assert_template "history"
-    ## FIXME need to add more checks to see which if edits are actually shown if your data is public
+    # FIXME: need to add more checks to see which if edits are actually shown if your data is public
   end
 
   ##
@@ -1829,7 +1841,7 @@ EOF
     assert_select "feed", :count => 1
     assert_select "entry", :count => changesets.size
     changesets.each do |_changeset|
-      # FIXME this test needs rewriting - test for feed contents
+      # FIXME: this test needs rewriting - test for feed contents
     end
   end
 
@@ -1841,7 +1853,7 @@ EOF
     assert_response :success
     assert_template "list"
     assert_equal "application/atom+xml", response.content_type
-    ## FIXME need to add more checks to see which if edits are actually shown if your data is public
+    # FIXME: need to add more checks to see which if edits are actually shown if your data is public
   end
 
   ##