]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/amf_controller_test.rb
Resolve 96 Rubocop Lint/AmbiguousRegexpLiteral conflicts
[rails.git] / test / controllers / amf_controller_test.rb
index 83ef03bbf95cc4fb1d31dc1d2169eb5c6153d1d7..b8cfd97cd8ab743ee78a69f6bd8eff6b7ae151ba 100644 (file)
@@ -1,8 +1,9 @@
 require "test_helper"
 require "stringio"
-include Potlatch
 
 class AmfControllerTest < ActionController::TestCase
+  include Potlatch
+
   ##
   # test all routes which lead to this controller
   def test_routes
@@ -214,8 +215,8 @@ class AmfControllerTest < ActionController::TestCase
     ways = map[2].collect { |x| x[0] }
     assert ways.include?(way.id),
            "map should include used way"
-    assert !ways.include?(deleted_way.id),
-           "map should not include deleted way"
+    assert_not ways.include?(deleted_way.id),
+               "map should not include deleted way"
   end
 
   ##
@@ -277,8 +278,8 @@ class AmfControllerTest < ActionController::TestCase
     assert_equal Array, map[2].class, "third map element should be an array"
     # TODO: looks like amf_controller changed since this test was written
     # so someone who knows what they're doing should check this!
-    assert !map[2].include?(way.id),
-           "map should not include visible way"
+    assert_not map[2].include?(way.id),
+               "map should not include visible way"
     assert map[2].include?(deleted_way.id),
            "map should include deleted way"
   end
@@ -498,7 +499,7 @@ class AmfControllerTest < ActionController::TestCase
 
     assert_equal 2, result.length
     assert_equal -1, result[0]
-    assert_match /must be logged in/, result[1]
+    assert_match(/must be logged in/, result[1])
 
     blocked_user = create(:user)
     create(:user_block, :user => blocked_user)
@@ -510,7 +511,7 @@ class AmfControllerTest < ActionController::TestCase
 
     assert_equal 2, result.length
     assert_equal -1, result[0]
-    assert_match /access to the API has been blocked/, result[1]
+    assert_match(/access to the API has been blocked/, result[1])
   end
 
   def test_findgpx_by_id
@@ -730,8 +731,8 @@ class AmfControllerTest < ActionController::TestCase
     # This node has no tags
 
     # create a node with random lat/lon
-    lat = rand(100) - 50 + rand
-    lon = rand(100) - 50 + rand
+    lat = rand(-50..49) + rand
+    lon = rand(-50..49) + rand
 
     changeset = create(:changeset)
     user = changeset.user
@@ -770,8 +771,8 @@ class AmfControllerTest < ActionController::TestCase
     # This node has some tags
 
     # create a node with random lat/lon
-    lat = rand(100) - 50 + rand
-    lon = rand(100) - 50 + rand
+    lat = rand(-50..49) + rand
+    lon = rand(-50..49) + rand
 
     amf_content "putpoi", "/2", ["#{user.email}:test", changeset.id, nil, nil, lon, lat, { "key" => "value", "ping" => "pong" }, nil]
     post :amf_write
@@ -811,8 +812,8 @@ class AmfControllerTest < ActionController::TestCase
     # This node has no tags
 
     # create a node with random lat/lon
-    lat = rand(100) - 50 + rand
-    lon = rand(100) - 50 + rand
+    lat = rand(-50..49) + rand
+    lon = rand(-50..49) + rand
 
     changeset = create(:changeset)
     user = changeset.user
@@ -847,8 +848,8 @@ class AmfControllerTest < ActionController::TestCase
     # This node has no tags
 
     # create a node with random lat/lon
-    lat = rand(100) - 50 + rand
-    lon = rand(100) - 50 + rand
+    lat = rand(-50..49) + rand
+    lon = rand(-50..49) + rand
 
     changeset = create(:changeset)
     user = changeset.user
@@ -940,7 +941,7 @@ class AmfControllerTest < ActionController::TestCase
 
     assert_equal 2, result.size
     assert_equal -2, result[0]
-    assert_match /Node is not in the world/, result[1]
+    assert_match(/Node is not in the world/, result[1])
   end
 
   # check that we can create a way
@@ -1193,7 +1194,7 @@ class AmfControllerTest < ActionController::TestCase
 
     assert_equal 2, result.size
     assert_equal -1, result[0]
-    assert_match /Way #{way.id} is still used/, result[1]
+    assert_match(/Way #{way.id} is still used/, result[1])
 
     new_way = Way.find(way.id)
     assert_equal way.version, new_way.version
@@ -1307,7 +1308,7 @@ class AmfControllerTest < ActionController::TestCase
 
     assert_equal 2, result.size
     assert_equal -1, result[0]
-    assert_match /relation #{relation.id} is used in/, result[1]
+    assert_match(/relation #{relation.id} is used in/, result[1])
 
     new_relation = Relation.find(relation.id)
     assert_equal relation.version, new_relation.version