1
0
Fork 0
forked from gitea/nas

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

This commit is contained in:
KMY 2024-09-26 08:29:41 +09:00
commit c905714459
517 changed files with 4284 additions and 3891 deletions

View file

@ -18,15 +18,13 @@ RSpec.describe 'Bookmarks' do
it_behaves_like 'forbidden for wrong scope', 'read'
context 'with public status' do
it 'bookmarks the status successfully', :aggregate_failures do
it 'bookmarks the status successfully and includes updated json', :aggregate_failures do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(user.account.bookmarked?(status)).to be true
end
it 'returns json with updated attributes' do
subject
expect(response.parsed_body).to match(
a_hash_including(id: status.id.to_s, bookmarked: true)
@ -41,6 +39,8 @@ RSpec.describe 'Bookmarks' do
subject
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
@ -55,6 +55,8 @@ RSpec.describe 'Bookmarks' do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(user.account.bookmarked?(status)).to be true
end
end
@ -64,6 +66,8 @@ RSpec.describe 'Bookmarks' do
post '/api/v1/statuses/-1/bookmark', headers: headers
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
@ -74,6 +78,8 @@ RSpec.describe 'Bookmarks' do
subject
expect(response).to have_http_status(401)
expect(response.content_type)
.to start_with('application/json')
end
end
end
@ -93,15 +99,13 @@ RSpec.describe 'Bookmarks' do
Bookmark.find_or_create_by!(account: user.account, status: status)
end
it 'unbookmarks the status successfully', :aggregate_failures do
it 'unbookmarks the status successfully and includes updated json', :aggregate_failures do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(user.account.bookmarked?(status)).to be false
end
it 'returns json with updated attributes' do
subject
expect(response.parsed_body).to match(
a_hash_including(id: status.id.to_s, bookmarked: false)
@ -117,15 +121,13 @@ RSpec.describe 'Bookmarks' do
status.account.block!(user.account)
end
it 'unbookmarks the status successfully', :aggregate_failures do
it 'unbookmarks the status successfully and includes updated json', :aggregate_failures do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(user.account.bookmarked?(status)).to be false
end
it 'returns json with updated attributes' do
subject
expect(response.parsed_body).to match(
a_hash_including(id: status.id.to_s, bookmarked: false)
@ -138,6 +140,8 @@ RSpec.describe 'Bookmarks' do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
end
end
end
@ -149,6 +153,8 @@ RSpec.describe 'Bookmarks' do
subject
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
end

View file

@ -33,9 +33,9 @@ RSpec.describe 'API V1 Statuses Favourited by Accounts' do
prev: api_v1_status_favourited_by_index_url(limit: 2, since_id: Favourite.last.id),
next: api_v1_status_favourited_by_index_url(limit: 2, max_id: Favourite.first.id)
)
expect(response.content_type)
.to start_with('application/json')
expect(response.parsed_body.size)
.to eq(2)
expect(response.parsed_body)
.to contain_exactly(
include(id: alice.id.to_s),
@ -48,9 +48,10 @@ RSpec.describe 'API V1 Statuses Favourited by Accounts' do
subject
expect(response.parsed_body.size)
.to eq 1
expect(response.parsed_body.first[:id]).to eq(alice.id.to_s)
expect(response.parsed_body)
.to contain_exactly(
hash_including(id: alice.id.to_s)
)
end
end
end
@ -72,6 +73,8 @@ RSpec.describe 'API V1 Statuses Favourited by Accounts' do
subject
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
end
@ -88,6 +91,8 @@ RSpec.describe 'API V1 Statuses Favourited by Accounts' do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
end
end
end

View file

@ -18,15 +18,13 @@ RSpec.describe 'Favourites', :inline_jobs do
it_behaves_like 'forbidden for wrong scope', 'read read:favourites'
context 'with public status' do
it 'favourites the status successfully', :aggregate_failures do
it 'favourites the status successfully and includes updated json', :aggregate_failures do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(user.account.favourited?(status)).to be true
end
it 'returns json with updated attributes' do
subject
expect(response.parsed_body).to match(
a_hash_including(id: status.id.to_s, favourites_count: 1, favourited: true)
@ -41,6 +39,8 @@ RSpec.describe 'Favourites', :inline_jobs do
subject
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
@ -55,6 +55,8 @@ RSpec.describe 'Favourites', :inline_jobs do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(user.account.favourited?(status)).to be true
end
end
@ -66,6 +68,8 @@ RSpec.describe 'Favourites', :inline_jobs do
subject
expect(response).to have_http_status(401)
expect(response.content_type)
.to start_with('application/json')
end
end
end
@ -84,16 +88,14 @@ RSpec.describe 'Favourites', :inline_jobs do
FavouriteService.new.call(user.account, status)
end
it 'unfavourites the status successfully', :aggregate_failures do
it 'unfavourites the status successfully and includes updated json', :aggregate_failures do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(user.account.favourited?(status)).to be false
end
it 'returns json with updated attributes' do
subject
expect(response.parsed_body).to match(
a_hash_including(id: status.id.to_s, favourites_count: 0, favourited: false)
@ -107,16 +109,14 @@ RSpec.describe 'Favourites', :inline_jobs do
status.account.block!(user.account)
end
it 'unfavourites the status successfully', :aggregate_failures do
it 'unfavourites the status successfully and includes updated json', :aggregate_failures do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(user.account.favourited?(status)).to be false
end
it 'returns json with updated attributes' do
subject
expect(response.parsed_body).to match(
a_hash_including(id: status.id.to_s, favourites_count: 0, favourited: false)
@ -129,6 +129,8 @@ RSpec.describe 'Favourites', :inline_jobs do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
end
end
@ -139,6 +141,8 @@ RSpec.describe 'Favourites', :inline_jobs do
subject
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
end

View file

@ -18,6 +18,8 @@ RSpec.describe 'API V1 Statuses Histories' do
it 'returns http success' do
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(response.parsed_body.size).to_not be 0
end
end

View file

@ -18,6 +18,8 @@ RSpec.describe 'API V1 Statuses Mutes' do
it 'creates a conversation mute', :aggregate_failures do
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(ConversationMute.find_by(account: user.account, conversation_id: status.conversation_id)).to_not be_nil
end
end
@ -32,6 +34,8 @@ RSpec.describe 'API V1 Statuses Mutes' do
it 'destroys the conversation mute', :aggregate_failures do
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(ConversationMute.find_by(account: user.account, conversation_id: status.conversation_id)).to be_nil
end
end

View file

@ -18,15 +18,13 @@ RSpec.describe 'Pins' do
it_behaves_like 'forbidden for wrong scope', 'read read:accounts'
context 'when the status is public' do
it 'pins the status successfully', :aggregate_failures do
it 'pins the status successfully and returns updated json', :aggregate_failures do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(user.account.pinned?(status)).to be true
end
it 'return json with updated attributes' do
subject
expect(response.parsed_body).to match(
a_hash_including(id: status.id.to_s, pinned: true)
@ -41,6 +39,8 @@ RSpec.describe 'Pins' do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(user.account.pinned?(status)).to be true
end
end
@ -52,6 +52,8 @@ RSpec.describe 'Pins' do
subject
expect(response).to have_http_status(422)
expect(response.content_type)
.to start_with('application/json')
end
end
@ -60,6 +62,8 @@ RSpec.describe 'Pins' do
post '/api/v1/statuses/-1/pin', headers: headers
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
@ -70,6 +74,8 @@ RSpec.describe 'Pins' do
subject
expect(response).to have_http_status(401)
expect(response.content_type)
.to start_with('application/json')
end
end
end
@ -86,15 +92,13 @@ RSpec.describe 'Pins' do
Fabricate(:status_pin, status: status, account: user.account)
end
it 'unpins the status successfully', :aggregate_failures do
it 'unpins the status successfully and includes updated json', :aggregate_failures do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(user.account.pinned?(status)).to be false
end
it 'return json with updated attributes' do
subject
expect(response.parsed_body).to match(
a_hash_including(id: status.id.to_s, pinned: false)
@ -107,6 +111,8 @@ RSpec.describe 'Pins' do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
end
end
@ -115,6 +121,8 @@ RSpec.describe 'Pins' do
post '/api/v1/statuses/-1/unpin', headers: headers
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
@ -125,6 +133,8 @@ RSpec.describe 'Pins' do
subject
expect(response).to have_http_status(401)
expect(response.content_type)
.to start_with('application/json')
end
end
end

View file

@ -32,9 +32,9 @@ RSpec.describe 'API V1 Statuses Reblogged by Accounts' do
prev: api_v1_status_reblogged_by_index_url(limit: 2, since_id: bob.statuses.first.id),
next: api_v1_status_reblogged_by_index_url(limit: 2, max_id: alice.statuses.first.id)
)
expect(response.content_type)
.to start_with('application/json')
expect(response.parsed_body.size)
.to eq(2)
expect(response.parsed_body)
.to contain_exactly(
include(id: alice.id.to_s),
@ -47,9 +47,10 @@ RSpec.describe 'API V1 Statuses Reblogged by Accounts' do
subject
expect(response.parsed_body.size)
.to eq 1
expect(response.parsed_body.first[:id]).to eq(alice.id.to_s)
expect(response.parsed_body)
.to contain_exactly(
hash_including(id: alice.id.to_s)
)
end
end
end
@ -71,6 +72,8 @@ RSpec.describe 'API V1 Statuses Reblogged by Accounts' do
subject
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
end
@ -87,6 +90,8 @@ RSpec.describe 'API V1 Statuses Reblogged by Accounts' do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
end
end
end

View file

@ -19,6 +19,8 @@ RSpec.describe 'API V1 Statuses Reblogs' do
context 'with public status' do
it 'reblogs the status', :aggregate_failures do
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(status.reblogs.count).to eq 1
@ -40,6 +42,8 @@ RSpec.describe 'API V1 Statuses Reblogs' do
it 'returns http not found' do
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
end
@ -55,6 +59,8 @@ RSpec.describe 'API V1 Statuses Reblogs' do
it 'destroys the reblog', :aggregate_failures do
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(status.reblogs.count).to eq 0
@ -80,6 +86,8 @@ RSpec.describe 'API V1 Statuses Reblogs' do
it 'destroys the reblog', :aggregate_failures do
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(status.reblogs.count).to eq 0
@ -103,6 +111,8 @@ RSpec.describe 'API V1 Statuses Reblogs' do
it 'returns http not found' do
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
end

View file

@ -22,6 +22,8 @@ RSpec.describe 'Sources' do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(response.parsed_body).to match({
id: status.id.to_s,
text: status.text,
@ -37,6 +39,8 @@ RSpec.describe 'Sources' do
subject
expect(response).to have_http_status(404)
expect(response.content_type)
.to start_with('application/json')
end
end
@ -51,6 +55,8 @@ RSpec.describe 'Sources' do
subject
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
expect(response.parsed_body).to match({
id: status.id.to_s,
text: status.text,
@ -66,6 +72,8 @@ RSpec.describe 'Sources' do
subject
expect(response).to have_http_status(401)
expect(response.content_type)
.to start_with('application/json')
end
end
end

View file

@ -20,6 +20,8 @@ RSpec.describe 'API V1 Statuses Translations' do
it 'returns http unprocessable entity' do
expect(response).to have_http_status(422)
expect(response.content_type)
.to start_with('application/json')
end
end
end
@ -38,6 +40,8 @@ RSpec.describe 'API V1 Statuses Translations' do
it 'returns http success' do
expect(response).to have_http_status(200)
expect(response.content_type)
.to start_with('application/json')
end
end
end