# create a way with pre-existing nodes
content "<osm><way changeset='#{changeset_id}'>" +
- "<nd ref='#{nid1}'/><nd ref='#{nid2}'/>" +
- "<tag k='test' v='yes' /></way></osm>"
+ "<nd ref='#{nid1}'/><nd ref='#{nid2}'/>" +
+ "<tag k='test' v='yes' /></way></osm>"
put :create
# hope for failure
assert_response :forbidden,
# create a way with pre-existing nodes
content "<osm><way changeset='#{changeset_id}'>" +
- "<nd ref='#{nid1}'/><nd ref='#{nid2}'/>" +
- "<tag k='test' v='yes' /></way></osm>"
+ "<nd ref='#{nid1}'/><nd ref='#{nid2}'/>" +
+ "<tag k='test' v='yes' /></way></osm>"
put :create
# hope for success
assert_response :success,
# create a way with non-existing node
content "<osm><way changeset='#{open_changeset_id}'>" +
- "<nd ref='0'/><tag k='test' v='yes' /></way></osm>"
+ "<nd ref='0'/><tag k='test' v='yes' /></way></osm>"
put :create
# expect failure
assert_response :forbidden,
# create a way with no nodes
content "<osm><way changeset='#{open_changeset_id}'>" +
- "<tag k='test' v='yes' /></way></osm>"
+ "<tag k='test' v='yes' /></way></osm>"
put :create
# expect failure
assert_response :forbidden,
# create a way inside a closed changeset
content "<osm><way changeset='#{closed_changeset_id}'>" +
- "<nd ref='#{nid1}'/></way></osm>"
+ "<nd ref='#{nid1}'/></way></osm>"
put :create
# expect failure
assert_response :forbidden,
# create a way with non-existing node
content "<osm><way changeset='#{open_changeset_id}'>" +
- "<nd ref='0'/><tag k='test' v='yes' /></way></osm>"
+ "<nd ref='0'/><tag k='test' v='yes' /></way></osm>"
put :create
# expect failure
assert_response :precondition_failed,
# create a way with no nodes
content "<osm><way changeset='#{open_changeset_id}'>" +
- "<tag k='test' v='yes' /></way></osm>"
+ "<tag k='test' v='yes' /></way></osm>"
put :create
# expect failure
assert_response :precondition_failed,
# create a way inside a closed changeset
content "<osm><way changeset='#{closed_changeset_id}'>" +
- "<nd ref='#{nid1}'/></way></osm>"
+ "<nd ref='#{nid1}'/></way></osm>"
put :create
# expect failure
assert_response :conflict,
# create a way with a tag which is too long
content "<osm><way changeset='#{open_changeset_id}'>" +
- "<nd ref='#{nid1}'/>" +
- "<tag k='foo' v='#{'x' * 256}'/>" +
- "</way></osm>"
+ "<nd ref='#{nid1}'/>" +
+ "<tag k='foo' v='#{'x' * 256}'/>" +
+ "</way></osm>"
put :create
# expect failure
assert_response :bad_request,
# check that the set of IDs match expectations
expected_way_ids = [current_ways(:visible_way).id,
- current_ways(:used_way).id
- ]
+ current_ways(:used_way).id]
found_way_ids = ways_xml.find("//osm/way").collect { |w| w["id"].to_i }
assert_equal expected_way_ids.sort, found_way_ids.sort,
"expected ways for node #{current_nodes(:used_node_1).id} did not match found"