]> git.openstreetmap.org Git - rails.git/commitdiff
Check that fractional part is present after . in geocoder latlon tests
authorAnton Khorev <tony29@yandex.ru>
Sat, 13 Jul 2024 13:09:08 +0000 (16:09 +0300)
committerAnton Khorev <tony29@yandex.ru>
Sat, 13 Jul 2024 13:09:08 +0000 (16:09 +0300)
test/controllers/geocoder_controller_test.rb

index 4d5d345c3189327df6a9afc5e982d99c23a020f2..5b76053214b22a8281e13f890790dfb515666606 100644 (file)
@@ -418,8 +418,8 @@ class GeocoderControllerTest < ActionDispatch::IntegrationTest
     assert_template :layout => "map"
     assert_equal %w[latlon osm_nominatim_reverse], assigns(:sources).pluck(:name)
     assert_nil @controller.params[:query]
-    assert_match(/^[+-]?\d+(?:\.\d*)?$/, @controller.params[:lat])
-    assert_match(/^[+-]?\d+(?:\.\d*)?$/, @controller.params[:lon])
+    assert_match(/^[+-]?\d+(?:\.\d+)?$/, @controller.params[:lat])
+    assert_match(/^[+-]?\d+(?:\.\d+)?$/, @controller.params[:lon])
     assert_in_delta lat, @controller.params[:lat].to_f
     assert_in_delta lon, @controller.params[:lon].to_f
 
@@ -429,8 +429,8 @@ class GeocoderControllerTest < ActionDispatch::IntegrationTest
     assert_template :layout => "xhr"
     assert_equal %w[latlon osm_nominatim_reverse], assigns(:sources).pluck(:name)
     assert_nil @controller.params[:query]
-    assert_match(/^[+-]?\d+(?:\.\d*)?$/, @controller.params[:lat])
-    assert_match(/^[+-]?\d+(?:\.\d*)?$/, @controller.params[:lon])
+    assert_match(/^[+-]?\d+(?:\.\d+)?$/, @controller.params[:lat])
+    assert_match(/^[+-]?\d+(?:\.\d+)?$/, @controller.params[:lon])
     assert_in_delta lat, @controller.params[:lat].to_f
     assert_in_delta lon, @controller.params[:lon].to_f
   end