remote_interaction_helper_spec.rb 814 B

123456789101112131415161718192021222324252627282930
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe 'Remote Interaction Helper' do
  4. describe 'GET /remote_interaction_helper' do
  5. it 'returns http success' do
  6. get remote_interaction_helper_path
  7. expect(response)
  8. .to have_http_status(200)
  9. .and render_template(:index, layout: 'helper_frame')
  10. .and have_attributes(
  11. headers: include(
  12. 'X-Frame-Options' => 'SAMEORIGIN',
  13. 'Referrer-Policy' => 'no-referrer',
  14. 'Content-Security-Policy' => expected_csp_headers
  15. )
  16. )
  17. end
  18. end
  19. private
  20. def expected_csp_headers
  21. <<~CSP.squish
  22. default-src 'none'; frame-ancestors 'self'; form-action 'none'; script-src 'self' https://cb6e6126.ngrok.io 'wasm-unsafe-eval'; connect-src https:
  23. CSP
  24. end
  25. end