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