2023-10-16 17:52:06 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
shared_examples 'cacheable response' do |expects_vary: false|
|
2024-02-27 12:50:21 +01:00
|
|
|
it 'sets correct cache and vary headers and does not set cookies or session', :aggregate_failures do
|
2023-10-16 17:52:06 +02:00
|
|
|
expect(response.cookies).to be_empty
|
|
|
|
expect(response.headers['Set-Cookies']).to be_nil
|
|
|
|
|
|
|
|
expect(session).to be_empty
|
|
|
|
|
2024-01-26 17:37:05 +01:00
|
|
|
expect(response.headers['Vary']).to include(expects_vary) if expects_vary
|
2023-10-16 17:52:06 +02:00
|
|
|
|
|
|
|
expect(response.headers['Cache-Control']).to include('public')
|
|
|
|
end
|
|
|
|
end
|