]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/api/map_controller_test.rb
JSON: added clarification for non-supported Accept header formats
[rails.git] / test / controllers / api / map_controller_test.rb
index c5392c723e776b54f03cae162065035c615d0c0e..d5cbfb4efadd0e9b24ccd8ad87dc7f3b9a78f945 100644 (file)
@@ -32,7 +32,7 @@ module Api
     ##
     # test http accept headers
     def test_http_accept_header
-      node = create(:node, :lat => 7, :lon => 7)
+      node = create(:node)
 
       minlon = node.lon - 0.1
       minlat = node.lat - 0.1
@@ -99,6 +99,12 @@ module Api
       http_accept_format("text/json")
       get :index, :params => { :bbox => bbox }
       assert_response :internal_server_error, "text/json should fail"
+
+      # image/jpeg is a format which we don't support, ActionController::UnknownFormat error is expected
+      # HTTP 406 Not acceptable would be the correct response error code. That's outside of our control though.
+      http_accept_format("image/jpeg")
+      get :index, :params => { :bbox => bbox }
+      assert_response :internal_server_error, "text/json should fail"
     end
 
     # -------------------------------------