mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Remove unused controller rescue_with_handler
Per https://github.com/rails-api/active_model_serializers/pull/954#discussion_r32589882 Ref 917, 918
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
require 'test_helper'
|
||||
|
||||
module ActionController
|
||||
module Serialization
|
||||
class RescueFromTest < ActionController::TestCase
|
||||
class RescueFromTestController < ActionController::Base
|
||||
rescue_from Exception, with: :handle_error
|
||||
|
||||
def render_using_raise_error_serializer
|
||||
profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
||||
render json: [profile], serializer: RaiseErrorSerializer
|
||||
end
|
||||
|
||||
def handle_error(exception)
|
||||
render json: { errors: ['Internal Server Error'] }, status: :internal_server_error
|
||||
end
|
||||
end
|
||||
|
||||
tests RescueFromTestController
|
||||
|
||||
def test_rescue_from
|
||||
get :render_using_raise_error_serializer
|
||||
|
||||
expected = {
|
||||
errors: ['Internal Server Error']
|
||||
}.to_json
|
||||
|
||||
assert_equal expected, response.body
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user