Sha256: 408f9dc14d77c78592f3445f6beef9030d009deca58e53195f3d05d300c0df07
Contents?: true
Size: 899 Bytes
Versions: 1
Compression:
Stored size: 899 Bytes
Contents
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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_model_serializers-0.10.0.rc2 | test/action_controller/rescue_from_test.rb |