2014-02-03 19:24:49 +00:00
|
|
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
2013-06-12 15:59:58 +00:00
|
|
|
|
2012-11-23 08:36:12 +00:00
|
|
|
class TestsController < ApplicationController
|
|
|
|
|
|
|
|
# GET /test/wait
|
|
|
|
def wait
|
|
|
|
sleep params[:sec].to_i
|
2015-04-27 13:42:53 +00:00
|
|
|
result = { success: true }
|
|
|
|
render json: result
|
2012-11-23 08:36:12 +00:00
|
|
|
end
|
|
|
|
|
2016-06-30 08:24:03 +00:00
|
|
|
# GET /test/unprocessable_entity
|
|
|
|
def error_unprocessable_entity
|
|
|
|
raise Exceptions::UnprocessableEntity, 'some error message'
|
|
|
|
end
|
|
|
|
|
|
|
|
# GET /test/not_authorized
|
|
|
|
def error_not_authorized
|
|
|
|
raise Exceptions::NotAuthorized, 'some error message'
|
|
|
|
end
|
|
|
|
|
|
|
|
# GET /test/ar_not_found
|
|
|
|
def error_ar_not_found
|
|
|
|
raise ActiveRecord::RecordNotFound, 'some error message'
|
|
|
|
end
|
|
|
|
|
|
|
|
# GET /test/standard_error
|
|
|
|
def error_standard_error
|
|
|
|
raise StandardError, 'some error message'
|
|
|
|
end
|
|
|
|
|
|
|
|
# GET /test/argument_error
|
|
|
|
def error_argument_error
|
|
|
|
raise ArgumentError, 'some error message'
|
|
|
|
end
|
|
|
|
|
2015-04-27 14:15:29 +00:00
|
|
|
end
|