]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/way_controller_test.rb
Add a few more tests
[rails.git] / test / controllers / way_controller_test.rb
index 3ae7aa36eb2d196af9c58c817813183edcdb6a14..ee68338891f3bd7119b9eb733775cc8278fe1609 100644 (file)
@@ -1,5 +1,5 @@
-require 'test_helper'
-require 'way_controller'
+require "test_helper"
+require "way_controller"
 
 class WayControllerTest < ActionController::TestCase
   api_fixtures
@@ -124,11 +124,9 @@ class WayControllerTest < ActionController::TestCase
       "<nd ref='#{nid1}'/><nd ref='#{nid2}'/>" +
       "<tag k='test' v='yes' /></way></osm>"
     put :create
-    # hope for success
+    # hope for failure
     assert_response :forbidden,
-                    "way upload did not return success status"
-    # read id of created way and search for it
-    wayid = @response.body
+                    "way upload did not return forbidden status"
 
     ## Now use a public user
     nid1 = current_nodes(:used_node_1).id
@@ -371,8 +369,8 @@ class WayControllerTest < ActionController::TestCase
 
     # add an identical tag to the way
     tag_xml = XML::Node.new("tag")
-    tag_xml['k'] = current_way_tags(:t1).k
-    tag_xml['v'] = current_way_tags(:t1).v
+    tag_xml["k"] = current_way_tags(:t1).k
+    tag_xml["v"] = current_way_tags(:t1).v
 
     # add the tag into the existing xml
     way_xml = current_ways(:visible_way).to_xml
@@ -390,8 +388,8 @@ class WayControllerTest < ActionController::TestCase
 
     # add an identical tag to the way
     tag_xml = XML::Node.new("tag")
-    tag_xml['k'] = current_way_tags(:t1).k
-    tag_xml['v'] = current_way_tags(:t1).v
+    tag_xml["k"] = current_way_tags(:t1).k
+    tag_xml["v"] = current_way_tags(:t1).v
 
     # add the tag into the existing xml
     way_xml = current_ways(:visible_way).to_xml
@@ -414,8 +412,8 @@ class WayControllerTest < ActionController::TestCase
 
     # create duplicate tag
     tag_xml = XML::Node.new("tag")
-    tag_xml['k'] = "i_am_a_duplicate"
-    tag_xml['v'] = "foobar"
+    tag_xml["k"] = "i_am_a_duplicate"
+    tag_xml["v"] = "foobar"
 
     # add the tag into the existing xml
     way_xml = current_ways(:visible_way).to_xml
@@ -435,8 +433,8 @@ class WayControllerTest < ActionController::TestCase
 
     # create duplicate tag
     tag_xml = XML::Node.new("tag")
-    tag_xml['k'] = "i_am_a_duplicate"
-    tag_xml['v'] = "foobar"
+    tag_xml["k"] = "i_am_a_duplicate"
+    tag_xml["v"] = "foobar"
 
     # add the tag into the existing xml
     way_xml = current_ways(:visible_way).to_xml
@@ -521,7 +519,7 @@ class WayControllerTest < ActionController::TestCase
   ##
   # update the changeset_id of a node element
   def update_changeset(xml, changeset_id)
-    xml_attr_rewrite(xml, 'changeset', changeset_id)
+    xml_attr_rewrite(xml, "changeset", changeset_id)
   end
 
   ##