# simple diff to change a node, way and relation by removing
# their tags
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<modify>
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset_id}' version='1'/>
</relation>
</modify>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset_id }, :body => diff
# simple diff to change a node, way and relation by removing
# their tags
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<modify>
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset_id}' version='1'/>
</relation>
</modify>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset_id }, :body => diff
# simple diff to change a node, way and relation by removing
# their tags
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<modify>
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset_id}' version='1'/>
</relation>
</modify>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset_id }, :body => diff
basic_authorization user.email, "test"
# simple diff to create a node way and relation using placeholders
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<create>
<node id='-1' lon='0' lat='0' changeset='#{changeset.id}'>
</relation>
</create>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset.id }, :body => diff
assert_select "diffResult>relation", 2
# check that everything was deleted
- assert_equal false, Node.find(used_node.id).visible
- assert_equal false, Way.find(used_way.id).visible
- assert_equal false, Relation.find(super_relation.id).visible
- assert_equal false, Relation.find(used_relation.id).visible
+ assert_not Node.find(used_node.id).visible
+ assert_not Way.find(used_way.id).visible
+ assert_not Relation.find(super_relation.id).visible
+ assert_not Relation.find(used_relation.id).visible
end
##
assert_select "diffResult>node", 1
# check that everything was deleted
- assert_equal false, Node.find(node.id).visible
+ assert_not Node.find(node.id).visible
end
def test_repeated_changeset_create
changeset_id = @response.body.to_i
# upload some widely-spaced nodes, spiralling positive and negative
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<create>
<node id='-1' lon='-20' lat='-10' changeset='#{changeset_id}'/>
<node id='-18' lon='179.9' lat='89.9' changeset='#{changeset_id}'/>
</create>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it, which used to cause an error like "PGError: ERROR:
# integer out of range" (bug #2152). but shouldn't any more.
assert_equal "Precondition failed: Way #{used_way.id} is still used by relations #{relation.id}.", @response.body
# check that nothing was, in fact, deleted
- assert_equal true, Node.find(used_node.id).visible
- assert_equal true, Way.find(used_way.id).visible
- assert_equal true, Relation.find(relation.id).visible
- assert_equal true, Relation.find(other_relation.id).visible
+ assert Node.find(used_node.id).visible
+ assert Way.find(used_way.id).visible
+ assert Relation.find(relation.id).visible
+ assert Relation.find(other_relation.id).visible
end
##
assert_equal used_relation.version, doc.find("//diffResult/relation").first["new_version"].to_i
# check that nothing was, in fact, deleted
- assert_equal true, Node.find(used_node.id).visible
- assert_equal true, Way.find(used_way.id).visible
- assert_equal true, Relation.find(used_relation.id).visible
+ assert Node.find(used_node.id).visible
+ assert Way.find(used_way.id).visible
+ assert Relation.find(used_relation.id).visible
end
##
basic_authorization changeset.user.email, "test"
# simple diff to create a node way and relation using placeholders
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<create>
<node id='-1' lon='0' lat='0' changeset='#{changeset.id}'>
</node>
</create>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset.id }, :body => diff
basic_authorization changeset.user.email, "test"
# simple diff to create a node way and relation using placeholders
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<create>
<node id='-1' lon='0' lat='0' changeset='#{changeset.id}'>
</relation>
</modify>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset.id }, :body => diff
basic_authorization changeset.user.email, "test"
# simple diff to create a node way and relation using placeholders
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<modify>
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset.id}' version='1'/>
</node>
</create>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset.id }, :body => diff
# change the location of a node multiple times, each time referencing
# the last version. doesn't this depend on version numbers being
# sequential?
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<modify>
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset.id}' version='1'/>
<node id='#{node.id}' lon='9' lat='9' changeset='#{changeset.id}' version='8'/>
</modify>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset.id }, :body => diff
basic_authorization changeset.user.email, "test"
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<modify>
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset.id}' version='1'/>
<node id='#{node.id}' lon='1' lat='1' changeset='#{changeset.id}' version='1'/>
</modify>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset.id }, :body => diff
basic_authorization changeset.user.email, "test"
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<modify>
<node id='1' lon='1' lat='1' changeset='#{changeset.id}'/>
</modify>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset.id }, :body => diff
basic_authorization changeset.user.email, "test"
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<ping>
<node id='1' lon='1' lat='1' changeset='#{changeset.id}' />
</ping>
</osmChange>
-CHANGESET
+ CHANGESET
post :upload, :params => { :id => changeset.id }, :body => diff
assert_response :bad_request, "Shouldn't be able to upload a diff with the action ping"
assert_equal @response.body, "Unknown action ping, choices are create, modify, delete"
basic_authorization changeset.user.email, "test"
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<modify><node id='#{node.id}' lon='0' lat='0' changeset='#{changeset.id}'
version='1'></node>
<member type='relation' role='some' ref='#{other_relation.id}'/>
</relation>
</modify></osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset.id }, :body => diff
basic_authorization changeset.user.email, "test"
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<create>
<node id='-1' lon='0' lat='0' changeset='#{changeset.id}'>
<node id='-1' lon='2' lat='2' changeset='#{changeset.id}' version='2'/>
</delete>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset.id }, :body => diff
basic_authorization changeset.user.email, "test"
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<create>
<node id='-1' lon='0' lat='0' changeset='#{changeset.id}' version='1'/>
<node id='-1' lon='2' lat='2' changeset='#{changeset.id}' version='2'/>
</create>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset.id }, :body => diff
basic_authorization changeset.user.email, "test"
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<create>
<node id="-1" lon="0" lat="0" changeset="#{changeset.id}" version="1"/>
</way>
</create>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset.id }, :body => diff
assert_equal "Placeholder node not found for reference -4 in way -1", @response.body
# the same again, but this time use an existing way
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<create>
<node id="-1" lon="0" lat="0" changeset="#{changeset.id}" version="1"/>
</way>
</create>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset.id }, :body => diff
basic_authorization changeset.user.email, "test"
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<create>
<node id="-1" lon="0" lat="0" changeset="#{changeset.id}" version="1"/>
</relation>
</create>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset.id }, :body => diff
assert_equal "Placeholder Node not found for reference -4 in relation -1.", @response.body
# the same again, but this time use an existing relation
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<create>
<node id="-1" lon="0" lat="0" changeset="#{changeset.id}" version="1"/>
</relation>
</create>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset.id }, :body => diff
changeset_id = @response.body.to_i
# add a diff to it
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<modify>
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset_id}' version='1'/>
<node id='#{node.id}' lon='9' lat='9' changeset='#{changeset_id}' version='8'/>
</modify>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset_id }, :body => diff
assert_response :success
changeset_id = @response.body.to_i
- diff = <<OSMFILE.strip_heredoc
+ diff = <<~OSMFILE
<osmChange version="0.6" generator="JOSM">
<create version="0.6" generator="JOSM">
<node id='-1' visible='true' changeset='#{changeset_id}' lat='51.49619982187321' lon='-0.18722061869438314' />
</way>
</create>
</osmChange>
-OSMFILE
+ OSMFILE
# upload it
post :upload, :params => { :id => changeset_id }, :body => diff
changeset_id = @response.body.to_i
# add a diff to it
- diff = <<CHANGESET.strip_heredoc
+ diff = <<~CHANGESET
<osmChange>
<delete>
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset_id}' version='1'/>
</way>
</modify>
</osmChange>
-CHANGESET
+ CHANGESET
# upload it
post :upload, :params => { :id => changeset_id }, :body => diff