1
0
Fork 0
forked from gitea/nas

Merge remote-tracking branch 'parent/main' into upstream-20240229

This commit is contained in:
KMY 2024-02-29 09:23:59 +09:00
commit 4b5fc77b6e
59 changed files with 562 additions and 780 deletions

View file

@ -44,14 +44,13 @@ describe Admin::InvitesController do
end
describe 'POST #deactivate_all' do
before { Fabricate(:invite, expires_at: nil) }
it 'expires all invites, then redirects to admin_invites_path' do
invites = Fabricate.times(1, :invite, expires_at: nil)
post :deactivate_all
invites.each do |invite|
expect(invite.reload).to be_expired
end
expect { post :deactivate_all }
.to change { Invite.exists?(expires_at: nil) }
.from(true)
.to(false)
expect(response).to redirect_to admin_invites_path
end

View file

@ -14,17 +14,6 @@ describe CustomCssController do
expect(response).to have_http_status(200)
end
it 'returns public cache control header' do
expect(response.headers['Cache-Control']).to include('public')
end
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
it_behaves_like 'cacheable response'
end
end

View file

@ -12,23 +12,18 @@ RSpec.describe InstanceActorsController do
get :show, params: { format: format }
end
it 'returns http success with correct media type, headers, and session values' do
it 'returns http success with correct media type and body' do
expect(response)
.to have_http_status(200)
.and have_attributes(
media_type: eq('application/activity+json'),
cookies: be_empty
media_type: eq('application/activity+json')
)
expect(response.headers)
.to include('Cache-Control' => include('public'))
.and not_include('Set-Cookies')
expect(session).to be_empty
expect(body_as_json)
.to include(:id, :type, :preferredUsername, :inbox, :publicKey, :inbox, :outbox, :url)
end
it_behaves_like 'cacheable response'
end
before do

View file

@ -14,17 +14,6 @@ describe ManifestsController do
expect(response).to have_http_status(200)
end
it 'returns public cache control header' do
expect(response.headers['Cache-Control']).to include('public')
end
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
it_behaves_like 'cacheable response'
end
end

View file

@ -20,13 +20,7 @@ RSpec.describe TagsController do
expect(response).to have_http_status(200)
end
it 'returns Vary header' do
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
end
it 'returns public Cache-Control header' do
expect(response.headers['Cache-Control']).to include 'public'
end
it_behaves_like 'cacheable response', expects_vary: 'Accept, Accept-Language, Cookie'
end
context 'when requested as JSON' do
@ -36,13 +30,7 @@ RSpec.describe TagsController do
expect(response).to have_http_status(200)
end
it 'returns Vary header' do
expect(response.headers['Vary']).to eq 'Accept, Accept-Language, Cookie'
end
it 'returns public Cache-Control header' do
expect(response.headers['Cache-Control']).to include 'public'
end
it_behaves_like 'cacheable response', expects_vary: 'Accept, Accept-Language, Cookie'
end
end