cors_preflight_check_spec.rb 500 B

12345678910111213141516171819202122232425
  1. require 'rails_helper'
  2. RSpec.describe 'CORS Preflight Check', type: :request do
  3. shared_examples 'empty response' do
  4. it { expect(response).to have_http_status(:ok) }
  5. it { expect(response.body).to be_empty }
  6. end
  7. context 'valid route' do
  8. before do
  9. process :options, '/'
  10. end
  11. include_examples 'empty response'
  12. end
  13. context 'invalid route' do
  14. before do
  15. process :options, '/this_is_an_invalid_route'
  16. end
  17. include_examples 'empty response'
  18. end
  19. end