]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/api/changesets_controller_test.rb
Update test results for changes to rescuable exception handling
[rails.git] / test / controllers / api / changesets_controller_test.rb
index 4339844140e2df80bcc856a7cfff56137dacb031..802e006e1190e025d898d120d6964b81a817d384 100644 (file)
@@ -134,12 +134,14 @@ module Api
 
     def test_create_wrong_method
       auth_header = basic_authorization_header create(:user).email, "test"
-      assert_raise ActionController::RoutingError do
-        get changeset_create_path, :headers => auth_header
-      end
-      assert_raise ActionController::RoutingError do
-        post changeset_create_path, :headers => auth_header
-      end
+
+      get changeset_create_path, :headers => auth_header
+      assert_response :not_found
+      assert_template "rescues/routing_error"
+
+      post changeset_create_path, :headers => auth_header
+      assert_response :not_found
+      assert_template "rescues/routing_error"
     end
 
     ##
@@ -199,7 +201,7 @@ module Api
       assert_equal Settings.api_version, js["version"]
       assert_equal Settings.generator, js["generator"]
       assert_equal changeset.id, js["changeset"]["id"]
-      assert js["changeset"]["open"]
+      assert_operator js["changeset"], :[], "open"
       assert_equal changeset.created_at.xmlschema, js["changeset"]["created_at"]
       assert_nil js["changeset"]["closed_at"]
       assert_nil js["changeset"]["tags"]
@@ -215,7 +217,7 @@ module Api
       assert_equal Settings.api_version, js["version"]
       assert_equal Settings.generator, js["generator"]
       assert_equal changeset.id, js["changeset"]["id"]
-      assert js["changeset"]["open"]
+      assert_operator js["changeset"], :[], "open"
       assert_equal changeset.created_at.xmlschema, js["changeset"]["created_at"]
       assert_nil js["changeset"]["closed_at"]
       assert_nil js["changeset"]["tags"]
@@ -361,13 +363,13 @@ module Api
 
       auth_header = basic_authorization_header user.email, "test"
 
-      assert_raise ActionController::RoutingError do
-        get changeset_close_path(changeset), :headers => auth_header
-      end
+      get changeset_close_path(changeset), :headers => auth_header
+      assert_response :not_found
+      assert_template "rescues/routing_error"
 
-      assert_raise ActionController::RoutingError do
-        post changeset_close_path(changeset), :headers => auth_header
-      end
+      post changeset_close_path(changeset), :headers => auth_header
+      assert_response :not_found
+      assert_template "rescues/routing_error"
     end
 
     ##
@@ -697,10 +699,10 @@ module Api
 
       # check that the changeset bbox is within bounds
       cs = Changeset.find(changeset_id)
-      assert cs.min_lon >= -180 * GeoRecord::SCALE, "Minimum longitude (#{cs.min_lon / GeoRecord::SCALE}) should be >= -180 to be valid."
-      assert cs.max_lon <= 180 * GeoRecord::SCALE, "Maximum longitude (#{cs.max_lon / GeoRecord::SCALE}) should be <= 180 to be valid."
-      assert cs.min_lat >= -90 * GeoRecord::SCALE, "Minimum latitude (#{cs.min_lat / GeoRecord::SCALE}) should be >= -90 to be valid."
-      assert cs.max_lat <= 90 * GeoRecord::SCALE, "Maximum latitude (#{cs.max_lat / GeoRecord::SCALE}) should be <= 90 to be valid."
+      assert_operator cs.min_lon, :>=, -180 * GeoRecord::SCALE, "Minimum longitude (#{cs.min_lon / GeoRecord::SCALE}) should be >= -180 to be valid."
+      assert_operator cs.max_lon, :<=, 180 * GeoRecord::SCALE, "Maximum longitude (#{cs.max_lon / GeoRecord::SCALE}) should be <= 180 to be valid."
+      assert_operator cs.min_lat, :>=, -90 * GeoRecord::SCALE, "Minimum latitude (#{cs.min_lat / GeoRecord::SCALE}) should be >= -90 to be valid."
+      assert_operator cs.max_lat, :<=, 90 * GeoRecord::SCALE, "Maximum latitude (#{cs.max_lat / GeoRecord::SCALE}) should be <= 90 to be valid."
     end
 
     ##