+ def test_search_by_bbox_success
+ notes = Array.new(5) do |i|
+ position = ((1.0 + (i * 0.1)) * GeoRecord::SCALE).to_i
+ create(:note_with_comments, :created_at => Time.parse("2020-01-01T00:00:00Z") + i.day, :latitude => position, :longitude => position)
+ end
+
+ get search_api_notes_path(:bbox => "1.0,1.0,1.6,1.6", :sort => "created_at", :order => "oldest", :format => "xml")
+ assert_response :success
+ assert_equal "application/xml", @response.media_type
+ assert_notes_in_order notes
+
+ get search_api_notes_path(:bbox => "1.25,1.25,1.45,1.45", :sort => "created_at", :order => "oldest", :format => "xml")
+ assert_response :success
+ assert_equal "application/xml", @response.media_type
+ assert_notes_in_order [notes[3], notes[4]]
+
+ get search_api_notes_path(:bbox => "2.0,2.0,2.5,2.5", :sort => "created_at", :order => "oldest", :format => "xml")
+ assert_response :success
+ assert_equal "application/xml", @response.media_type
+ assert_notes_in_order []
+ end
+