diff options
Diffstat (limited to 'spec/controllers/application_controller_spec.rb')
-rw-r--r-- | spec/controllers/application_controller_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 004bea02580..ddd80b67639 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -501,6 +501,7 @@ RSpec.describe ApplicationController do describe '#append_info_to_payload' do controller(described_class) do attr_reader :last_payload + urgency :high, [:foo] def index @@ -1058,15 +1059,25 @@ RSpec.describe ApplicationController do describe 'setting permissions-policy header' do controller do skip_before_action :authenticate_user! + before_action :redirect_to_example, only: [:redirect] def index render html: 'It is a flock of sheep, not a floc of sheep.' end + + def redirect + raise 'Should not be reached' + end + + def redirect_to_example + redirect_to('https://example.com') + end end before do routes.draw do get 'index' => 'anonymous#index' + get 'redirect' => 'anonymous#redirect' end end @@ -1092,6 +1103,13 @@ RSpec.describe ApplicationController do expect(response.headers['Permissions-Policy']).to eq('interest-cohort=()') end + + it 'sets the Permissions-Policy header even when redirected before_action' do + get :redirect + + expect(response).to have_gitlab_http_status(:redirect) + expect(response.headers['Permissions-Policy']).to eq('interest-cohort=()') + end end end end |