You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
549 B
23 lines
549 B
1 year ago
|
# frozen_string_literal: true
|
||
|
|
||
|
shared_examples 'cacheable response' do |expects_vary: false|
|
||
|
it 'does not set cookies' do
|
||
|
expect(response.cookies).to be_empty
|
||
|
expect(response.headers['Set-Cookies']).to be_nil
|
||
|
end
|
||
|
|
||
|
it 'does not set sessions' do
|
||
|
expect(session).to be_empty
|
||
|
end
|
||
|
|
||
|
if expects_vary
|
||
|
it 'returns Vary header' do
|
||
|
expect(response.headers['Vary']).to include(expects_vary)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
it 'returns public Cache-Control header' do
|
||
|
expect(response.headers['Cache-Control']).to include('public')
|
||
|
end
|
||
|
end
|