Fix rubocop warnings

This commit is contained in:
Tom Hughes 2016-06-09 22:18:28 +01:00
parent 2ea4ecce54
commit 72e71b9972
9 changed files with 26 additions and 35 deletions

View file

@ -308,8 +308,7 @@ class AmfControllerTest < ActionController::TestCase
# try to get version 1
v1 = ways(:way_with_versions_v2)
{ latest.id => "",
v1.way_id => v1.timestamp.strftime("%d %b %Y, %H:%M:%S")
}.each do |id, t|
v1.way_id => v1.timestamp.strftime("%d %b %Y, %H:%M:%S") }.each do |id, t|
amf_content "getway_old", "/1", [id, t]
post :amf_read
assert_response :success
@ -329,10 +328,9 @@ class AmfControllerTest < ActionController::TestCase
way_id = current_ways(:way_with_versions).id
{ "foo" => "bar",
way_id => "not a date",
way_id => "2009-03-25 00:00:00", # <- wrong format
way_id => "0 Jan 2009 00:00:00", # <- invalid date
-1 => "1 Jan 2009 00:00:00" # <- invalid ID
}.each do |id, t|
way_id => "2009-03-25 00:00:00", # <- wrong format
way_id => "0 Jan 2009 00:00:00", # <- invalid date
-1 => "1 Jan 2009 00:00:00" }.each do |id, t| # <- invalid
amf_content "getway_old", "/1", [id, t]
post :amf_read
assert_response :success
@ -352,8 +350,7 @@ class AmfControllerTest < ActionController::TestCase
# try to get specific version of non-existent way
[[0, ""],
[0, "1 Jan 1970, 00:00:00"],
[v1.way_id, (v1.timestamp - 10).strftime("%d %b %Y, %H:%M:%S")]
].each do |id, t|
[v1.way_id, (v1.timestamp - 10).strftime("%d %b %Y, %H:%M:%S")]].each do |id, t|
amf_content "getway_old", "/1", [id, t]
post :amf_read
assert_response :success
@ -369,8 +366,7 @@ class AmfControllerTest < ActionController::TestCase
def test_getway_old_invisible
v1 = ways(:invisible_way)
# try to get deleted version
[[v1.way_id, (v1.timestamp + 10).strftime("%d %b %Y, %H:%M:%S")]
].each do |id, t|
[[v1.way_id, (v1.timestamp + 10).strftime("%d %b %Y, %H:%M:%S")]].each do |id, t|
amf_content "getway_old", "/1", [id, t]
post :amf_read
assert_response :success

View file

@ -1181,8 +1181,7 @@ EOF
["<osmChange/>",
"<osmChange></osmChange>",
"<osmChange><modify/></osmChange>",
"<osmChange><modify></modify></osmChange>"
].each do |diff|
"<osmChange><modify></modify></osmChange>"].each do |diff|
# upload it
content diff
post :upload, :id => changesets(:public_user_first_change).id
@ -1598,8 +1597,7 @@ EOF
def test_query_invalid
["abracadabra!",
"1,2,3,F",
";drop table users;"
].each do |bbox|
";drop table users;"].each do |bbox|
get :query, :bbox => bbox
assert_response :bad_request, "'#{bbox}' isn't a bbox"
end
@ -1608,8 +1606,7 @@ EOF
"00-00-00",
";drop table users;",
",",
"-,-"
].each do |time|
"-,-"].each do |time|
get :query, :time => time
assert_response :bad_request, "'#{time}' isn't a valid time range"
end
@ -1617,8 +1614,7 @@ EOF
["me",
"foobar",
"-1",
"0"
].each do |uid|
"0"].each do |uid|
get :query, :user => uid
assert_response :bad_request, "'#{uid}' isn't a valid user ID"
end

View file

@ -607,8 +607,7 @@ class RelationControllerTest < ActionController::TestCase
[current_nodes(:used_node_1),
current_nodes(:used_node_2),
current_ways(:used_way),
current_ways(:way_with_versions)
].each_with_index do |element, _version|
current_ways(:way_with_versions)].each_with_index do |element, _version|
bbox = element.bbox.to_unscaled
check_changeset_modify(bbox) do |changeset_id|
relation_xml = Relation.find(relation_id).to_xml

View file

@ -673,8 +673,7 @@ class WayControllerTest < ActionController::TestCase
# 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"

View file

@ -61,8 +61,7 @@ class MessageTest < ActiveSupport::TestCase
"\xC2\xC2", # 2-byte multibyte identifier, followed by another one
"\x4a\x82", # plain ASCII, followed by multibyte continuation
"\x82\x82", # multibyte continuations without multibyte identifier
"\xe1\x82\x4a", # three-byte identifier, contination and (incorrectly) plain ASCII
]
"\xe1\x82\x4a"] # three-byte identifier, contination and (incorrectly) plain ASCII
invalid_sequences.each do |char|
begin
# create a message and save to the database