cors_preflight_check_spec.rb 577 B

123456789101112131415161718192021222324252627
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'CORS Preflight Check', type: :request do
  4. shared_examples 'empty response' do
  5. it { expect(response).to have_http_status(:ok) }
  6. it { expect(response.body).to be_empty }
  7. end
  8. context 'valid route' do
  9. before do
  10. process :options, '/'
  11. end
  12. include_examples 'empty response'
  13. end
  14. context 'invalid route' do
  15. before do
  16. process :options, '/this_is_an_invalid_route'
  17. end
  18. include_examples 'empty response'
  19. end
  20. end