1 require_relative "queries_controller_test"
4 class LatlonQueriesControllerTest < QueriesControllerTest
6 # test all routes which lead to this controller
9 { :path => "/search/latlon_query", :method => :post },
10 { :controller => "searches/latlon_queries", :action => "create" }
15 post search_latlon_query_path(:lat => 1.23, :lon => 4.56, :zoom => 16), :xhr => true
16 results_check :name => "1.23, 4.56", :lat => 1.23, :lon => 4.56, :zoom => 16
18 post search_latlon_query_path(:lat => -91.23, :lon => 4.56, :zoom => 16), :xhr => true
19 results_check_error "Latitude -91.23 out of range"
21 post search_latlon_query_path(:lat => 91.23, :lon => 4.56, :zoom => 16), :xhr => true
22 results_check_error "Latitude 91.23 out of range"
24 post search_latlon_query_path(:lat => 1.23, :lon => -180.23, :zoom => 16), :xhr => true
25 results_check_error "Longitude -180.23 out of range"
27 post search_latlon_query_path(:lat => 1.23, :lon => 180.23, :zoom => 16), :xhr => true
28 results_check_error "Longitude 180.23 out of range"
31 def test_create_digits
32 post search_latlon_query_path(:lat => 1.23, :lon => 4.56, :zoom => 16, :latlon_digits => true), :xhr => true
33 results_check({ :name => "1.23, 4.56", :lat => 1.23, :lon => 4.56, :zoom => 16 },
34 { :name => "4.56, 1.23", :lat => 4.56, :lon => 1.23, :zoom => 16 })
36 post search_latlon_query_path(:lat => -91.23, :lon => 4.56, :zoom => 16, :latlon_digits => true), :xhr => true
37 results_check :name => "4.56, -91.23", :lat => 4.56, :lon => -91.23, :zoom => 16
39 post search_latlon_query_path(:lat => -1.23, :lon => 170.23, :zoom => 16, :latlon_digits => true), :xhr => true
40 results_check :name => "-1.23, 170.23", :lat => -1.23, :lon => 170.23, :zoom => 16
42 post search_latlon_query_path(:lat => 91.23, :lon => 94.56, :zoom => 16, :latlon_digits => true), :xhr => true
43 results_check_error "Latitude or longitude are out of range"
45 post search_latlon_query_path(:lat => -91.23, :lon => -94.56, :zoom => 16, :latlon_digits => true), :xhr => true
46 results_check_error "Latitude or longitude are out of range"
48 post search_latlon_query_path(:lat => 1.23, :lon => -180.23, :zoom => 16, :latlon_digits => true), :xhr => true
49 results_check_error "Latitude or longitude are out of range"
51 post search_latlon_query_path(:lat => 1.23, :lon => 180.23, :zoom => 16, :latlon_digits => true), :xhr => true
52 results_check_error "Latitude or longitude are out of range"