1 # frozen_string_literal: true
 
   3 require_relative "queries_controller_test"
 
   6   class NominatimQueriesControllerTest < QueriesControllerTest
 
   8     # test all routes which lead to this controller
 
  11         { :path => "/search/nominatim_query", :method => :post },
 
  12         { :controller => "searches/nominatim_queries", :action => "create" }
 
  17       with_http_stubs "nominatim" do
 
  18         post search_nominatim_query_path(:query => "Hoddesdon", :zoom => 10,
 
  19                                          :minlon => -0.559, :minlat => 51.217,
 
  20                                          :maxlon => 0.836, :maxlat => 51.766), :xhr => true
 
  21         results_check "name" => "Hoddesdon, Hertfordshire, East of England, England, United Kingdom",
 
  22                       "min-lat" => 51.7216709, "max-lat" => 51.8016709,
 
  23                       "min-lon" => -0.0512898, "max-lon" => 0.0287102,
 
  24                       "type" => "node", "id" => 18007599
 
  26         post search_nominatim_query_path(:query => "Broxbourne", :zoom => 10,
 
  27                                          :minlon => -0.559, :minlat => 51.217,
 
  28                                          :maxlon => 0.836, :maxlat => 51.766), :xhr => true
 
  29         results_check({ "prefix" => "Suburb",
 
  30                         "name" => "Broxbourne, Hertfordshire, East of England, England, United Kingdom",
 
  31                         "min-lat" => 51.7265723, "max-lat" => 51.7665723,
 
  32                         "min-lon" => -0.0390782, "max-lon" => 0.0009218,
 
  33                         "type" => "node", "id" => 28825933 },
 
  34                       { "prefix" => "Village",
 
  35                         "name" => "Broxbourne, Hertfordshire, East of England, England, United Kingdom",
 
  36                         "min-lat" => 51.6808751, "max-lat" => 51.7806237,
 
  37                         "min-lon" => -0.114204, "max-lon" => 0.0145267,
 
  38                         "type" => "relation", "id" => 2677978 },
 
  39                       { "prefix" => "Railway Station",
 
  40                         "name" => "Broxbourne, Stafford Drive, Broxbourne, Hertfordshire, East of England, England, United Kingdom",
 
  41                         "min-lat" => 51.7418469, "max-lat" => 51.7518469,
 
  42                         "min-lon" => -0.0156773, "max-lon" => -0.0056773,
 
  43                         "type" => "node", "id" => 17044599 })