Fix new rubocop warnings

This commit is contained in:
Tom Hughes 2016-02-05 12:28:16 +00:00
parent c7061991e7
commit 5d3ecffa28
41 changed files with 252 additions and 250 deletions

View file

@ -102,16 +102,16 @@ class ChangesetControllerTest < ActionController::TestCase
basic_authorization users(:normal_user).email, "test"
# Create the first user's changeset
content "<osm><changeset>" +
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
put :create
assert_require_public_data
basic_authorization users(:public_user).email, "test"
# Create the first user's changeset
content "<osm><changeset>" +
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
put :create
assert_response :success, "Creation of changeset did not return sucess status"
@ -527,8 +527,8 @@ EOF
# create a temporary changeset
content "<osm><changeset>" +
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
assert_difference "Changeset.count", 1 do
put :create
end
@ -1102,8 +1102,8 @@ EOF
basic_authorization users(:public_user).email, "test"
content "<osm><changeset>" +
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
put :create
assert_response :success
changeset_id = @response.body.to_i
@ -1140,8 +1140,8 @@ EOF
basic_authorization users(:public_user).email, "test"
content "<osm><changeset>" +
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
put :create
assert_response :success
changeset_id = @response.body.to_i
@ -1225,8 +1225,8 @@ EOF
# create a temporary changeset
content "<osm><changeset>" +
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
put :create
assert_response :forbidden
@ -1235,8 +1235,8 @@ EOF
# create a temporary changeset
content "<osm><changeset>" +
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
put :create
assert_response :success
changeset_id = @response.body.to_i
@ -1281,8 +1281,8 @@ EOF
# create a temporary changeset
content "<osm><changeset>" +
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
put :create
assert_response :success
changeset_id = @response.body.to_i
@ -1340,8 +1340,8 @@ OSMFILE
# create a temporary changeset
content "<osm><changeset>" +
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
put :create
assert_response :success
changeset_id = @response.body.to_i

View file

@ -466,8 +466,8 @@ class NodeControllerTest < ActionController::TestCase
# try and put something into a string that the API might
# use unquoted and therefore allow code injection...
content "<osm><node lat='0' lon='0' changeset='#{changeset_id}'>" +
'<tag k="#{@user.inspect}" v="0"/>' +
"</node></osm>"
'<tag k="#{@user.inspect}" v="0"/>' +
"</node></osm>"
put :create
assert_require_public_data "Shouldn't be able to create with non-public user"
@ -478,8 +478,8 @@ class NodeControllerTest < ActionController::TestCase
# try and put something into a string that the API might
# use unquoted and therefore allow code injection...
content "<osm><node lat='0' lon='0' changeset='#{changeset_id}'>" +
'<tag k="#{@user.inspect}" v="0"/>' +
"</node></osm>"
'<tag k="#{@user.inspect}" v="0"/>' +
"</node></osm>"
put :create
assert_response :success
nodeid = @response.body

View file

@ -165,8 +165,8 @@ class RelationControllerTest < ActionController::TestCase
# This time try with a role attribute in the relation
nid = current_nodes(:used_node_1).id
content "<osm><relation changeset='#{changeset_id}'>" +
"<member ref='#{nid}' type='node' role='some'/>" +
"<tag k='test' v='yes' /></relation></osm>"
"<member ref='#{nid}' type='node' role='some'/>" +
"<tag k='test' v='yes' /></relation></osm>"
put :create
# hope for forbidden due to user
assert_response :forbidden,
@ -177,7 +177,7 @@ class RelationControllerTest < ActionController::TestCase
# need a role attribute to be included
nid = current_nodes(:used_node_1).id
content "<osm><relation changeset='#{changeset_id}'>" +
"<member ref='#{nid}' type='node'/>" + "<tag k='test' v='yes' /></relation></osm>"
"<member ref='#{nid}' type='node'/>" + "<tag k='test' v='yes' /></relation></osm>"
put :create
# hope for forbidden due to user
assert_response :forbidden,
@ -188,9 +188,9 @@ class RelationControllerTest < ActionController::TestCase
nid = current_nodes(:used_node_1).id
wid = current_ways(:used_way).id
content "<osm><relation changeset='#{changeset_id}'>" +
"<member type='node' ref='#{nid}' role='some'/>" +
"<member type='way' ref='#{wid}' role='other'/>" +
"<tag k='test' v='yes' /></relation></osm>"
"<member type='node' ref='#{nid}' role='some'/>" +
"<member type='way' ref='#{wid}' role='other'/>" +
"<tag k='test' v='yes' /></relation></osm>"
put :create
# hope for forbidden, due to user
assert_response :forbidden,
@ -233,8 +233,8 @@ class RelationControllerTest < ActionController::TestCase
# This time try with a role attribute in the relation
nid = current_nodes(:used_node_1).id
content "<osm><relation changeset='#{changeset_id}'>" +
"<member ref='#{nid}' type='node' role='some'/>" +
"<tag k='test' v='yes' /></relation></osm>"
"<member ref='#{nid}' type='node' role='some'/>" +
"<tag k='test' v='yes' /></relation></osm>"
put :create
# hope for success
assert_response :success,
@ -265,7 +265,7 @@ class RelationControllerTest < ActionController::TestCase
# need a role attribute to be included
nid = current_nodes(:used_node_1).id
content "<osm><relation changeset='#{changeset_id}'>" +
"<member ref='#{nid}' type='node'/>" + "<tag k='test' v='yes' /></relation></osm>"
"<member ref='#{nid}' type='node'/>" + "<tag k='test' v='yes' /></relation></osm>"
put :create
# hope for success
assert_response :success,
@ -296,9 +296,9 @@ class RelationControllerTest < ActionController::TestCase
nid = current_nodes(:used_node_1).id
wid = current_ways(:used_way).id
content "<osm><relation changeset='#{changeset_id}'>" +
"<member type='node' ref='#{nid}' role='some'/>" +
"<member type='way' ref='#{wid}' role='other'/>" +
"<tag k='test' v='yes' /></relation></osm>"
"<member type='node' ref='#{nid}' role='some'/>" +
"<member type='way' ref='#{wid}' role='other'/>" +
"<tag k='test' v='yes' /></relation></osm>"
put :create
# hope for success
assert_response :success,
@ -412,8 +412,8 @@ class RelationControllerTest < ActionController::TestCase
# create a relation with non-existing node as member
content "<osm><relation changeset='#{changeset_id}'>" +
"<member type='node' ref='0'/><tag k='test' v='yes' />" +
"</relation></osm>"
"<member type='node' ref='0'/><tag k='test' v='yes' />" +
"</relation></osm>"
put :create
# expect failure
assert_response :precondition_failed,
@ -432,8 +432,8 @@ class RelationControllerTest < ActionController::TestCase
# create some xml that should return an error
content "<osm><relation changeset='#{changeset_id}'>" +
"<member type='type' ref='#{current_nodes(:used_node_1).id}' role=''/>" +
"<tag k='tester' v='yep'/></relation></osm>"
"<member type='type' ref='#{current_nodes(:used_node_1).id}' role=''/>" +
"<tag k='tester' v='yep'/></relation></osm>"
put :create
# expect failure
assert_response :bad_request
@ -963,7 +963,7 @@ OSM
a_tags.each do |k, v|
assert_equal v, b_tags[k],
"Tags which were not altered should be the same. " +
"#{a_tags.inspect} != #{b_tags.inspect}"
"#{a_tags.inspect} != #{b_tags.inspect}"
end
end

View file

@ -121,8 +121,8 @@ class WayControllerTest < ActionController::TestCase
# 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,
@ -138,8 +138,8 @@ class WayControllerTest < ActionController::TestCase
# 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,
@ -179,7 +179,7 @@ class WayControllerTest < ActionController::TestCase
# 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,
@ -187,7 +187,7 @@ class WayControllerTest < ActionController::TestCase
# 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,
@ -195,7 +195,7 @@ class WayControllerTest < ActionController::TestCase
# 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,
@ -211,7 +211,7 @@ class WayControllerTest < ActionController::TestCase
# 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,
@ -220,7 +220,7 @@ class WayControllerTest < ActionController::TestCase
# 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,
@ -229,7 +229,7 @@ class WayControllerTest < ActionController::TestCase
# 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,
@ -237,9 +237,9 @@ class WayControllerTest < ActionController::TestCase
# 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,