]> git.openstreetmap.org Git - rails.git/blob - test/controllers/searches/nominatim_reverse_queries_controller_test.rb
Merge remote-tracking branch 'upstream/pull/5967'
[rails.git] / test / controllers / searches / nominatim_reverse_queries_controller_test.rb
1 require_relative "queries_controller_test"
2
3 module Searches
4   class NominatimReverseQueriesControllerTest < QueriesControllerTest
5     ##
6     # test all routes which lead to this controller
7     def test_routes
8       assert_routing(
9         { :path => "/search/nominatim_reverse_query", :method => :post },
10         { :controller => "searches/nominatim_reverse_queries", :action => "create" }
11       )
12     end
13
14     def test_create
15       with_http_stubs "nominatim" do
16         post search_nominatim_reverse_query_path(:lat => 51.7632, :lon => -0.0076, :zoom => 15), :xhr => true
17         results_check :name => "Broxbourne, Hertfordshire, East of England, England, United Kingdom",
18                       :lat => 51.7465723, :lon => -0.0190782,
19                       :type => "node", :id => 28825933, :zoom => 15
20
21         post search_nominatim_reverse_query_path(:lat => 51.7632, :lon => -0.0076, :zoom => 17), :xhr => true
22         results_check :name => "Dinant Link Road, Broxbourne, Hertfordshire, East of England, England, EN11 8HX, United Kingdom",
23                       :lat => 51.7634883, :lon => -0.0088373,
24                       :type => "way", :id => 3489841, :zoom => 17
25
26         post search_nominatim_reverse_query_path(:lat => 13.7709, :lon => 100.50507, :zoom => 19), :xhr => true
27         results_check :name => "MM Steak&Grill, ถนนศรีอยุธยา, บางขุนพรหม, กรุงเทพมหานคร, เขตดุสิต, กรุงเทพมหานคร, 10300, ประเทศไทย",
28                       :lat => 13.7708691, :lon => 100.505073233221,
29                       :type => "way", :id => 542901374, :zoom => 19
30       end
31     end
32   end
33 end