tests_controller.rb 845 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
  2. class TestsController < ApplicationController
  3. # GET /test/wait
  4. def wait
  5. sleep params[:sec].to_i
  6. result = { success: true }
  7. render json: result
  8. end
  9. # GET /test/unprocessable_entity
  10. def error_unprocessable_entity
  11. raise Exceptions::UnprocessableEntity, 'some error message'
  12. end
  13. # GET /test/not_authorized
  14. def error_not_authorized
  15. raise Exceptions::NotAuthorized, 'some error message'
  16. end
  17. # GET /test/ar_not_found
  18. def error_ar_not_found
  19. raise ActiveRecord::RecordNotFound, 'some error message'
  20. end
  21. # GET /test/standard_error
  22. def error_standard_error
  23. raise StandardError, 'some error message'
  24. end
  25. # GET /test/argument_error
  26. def error_argument_error
  27. raise ArgumentError, 'some error message'
  28. end
  29. end