diff options
Diffstat (limited to 'spec/controllers/application_controller_spec.rb')
-rw-r--r-- | spec/controllers/application_controller_spec.rb | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 3d34db6c2c0..0235d7eb95a 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -725,7 +725,7 @@ RSpec.describe ApplicationController do format.csv do stream_csv_headers('test.csv') - self.response_body = fixture_file_upload('spec/fixtures/csv_comma.csv') + self.response_body = Rack::Test::UploadedFile.new('spec/fixtures/csv_comma.csv') end end end @@ -1027,4 +1027,44 @@ RSpec.describe ApplicationController do get :index end end + + describe 'setting permissions-policy header' do + controller do + skip_before_action :authenticate_user! + + def index + render html: 'It is a flock of sheep, not a floc of sheep.' + end + end + + before do + routes.draw do + get 'index' => 'anonymous#index' + end + end + + context 'with FloC enabled' do + before do + stub_application_setting floc_enabled: true + end + + it 'does not set the Permissions-Policy header' do + get :index + + expect(response.headers['Permissions-Policy']).to eq(nil) + end + end + + context 'with FloC disabled' do + before do + stub_application_setting floc_enabled: false + end + + it 'sets the Permissions-Policy header' do + get :index + + expect(response.headers['Permissions-Policy']).to eq('interest-cohort=()') + end + end + end end |