WIP: preserve Issue #479 changes

このコミットが含まれているのは:
Codex Night Worker
2026-11-15 15:40:04 +09:00
コミット 63ea2727f0
35個のファイルの変更、97行の追加、97行の削除
+24 -24
ファイルの表示
@@ -1042,7 +1042,7 @@ RSpec.describe 'Posts API', type: :request do
get '/posts/metadata', params: { url: 'file:///etc/passwd' }
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json.fetch('errors')).to have_key('url')
end
end
@@ -1180,7 +1180,7 @@ RSpec.describe 'Posts API', type: :request do
)
}.not_to change(Post, :count)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json.fetch('errors')).to include(
'thumbnail' => ['サムネイル画像の変換に失敗しました.']
)
@@ -1219,7 +1219,7 @@ RSpec.describe 'Posts API', type: :request do
thumbnail: dummy_upload
)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json.fetch('errors')).to include(
'tags' => ['廃止済みタグがあります: deprecated_direct_tag']
)
@@ -1265,7 +1265,7 @@ RSpec.describe 'Posts API', type: :request do
thumbnail: dummy_upload
)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json).to include(
'type' => 'validation_error',
'message' => '入力内容を確認してください.'
@@ -1333,7 +1333,7 @@ RSpec.describe 'Posts API', type: :request do
thumbnail: dummy_upload
)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json.fetch('errors')).to include(
'video_ms' => ['タグ区間の終端が動画時間を超えてゐます.']
)
@@ -1444,7 +1444,7 @@ RSpec.describe 'Posts API', type: :request do
thumbnail: dummy_upload
)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json.fetch('errors')).to include(
'video_ms' => ['タグ区間の開始が動画時間以上です.']
)
@@ -1465,7 +1465,7 @@ RSpec.describe 'Posts API', type: :request do
thumbnail: dummy_upload
)
expect(response).to have_http_status(:unprocessable_entity), response.body
expect(response).to have_http_status(:unprocessable_content), response.body
expect(json).to include(
'type' => 'validation_error',
'message' => '入力内容を確認してください.',
@@ -1485,7 +1485,7 @@ RSpec.describe 'Posts API', type: :request do
tags: 'spec_tag', # 既存タグ名を投げる
thumbnail: dummy_upload)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end
end
@@ -1499,7 +1499,7 @@ RSpec.describe 'Posts API', type: :request do
tags: 'spec_tag', # 既存タグ名を投げる
thumbnail: dummy_upload)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end
end
@@ -1601,7 +1601,7 @@ RSpec.describe 'Posts API', type: :request do
thumbnail: dummy_upload }
}.not_to change(Post, :count)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json.fetch('errors')).to be_present
end
end
@@ -1620,7 +1620,7 @@ RSpec.describe 'Posts API', type: :request do
)
}.not_to change(Post, :count)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json.fetch('errors')).to be_present
end
end
@@ -1639,7 +1639,7 @@ RSpec.describe 'Posts API', type: :request do
)
}.not_to change(PostImplication, :count)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json.fetch('errors')).to be_present
end
end
@@ -1770,7 +1770,7 @@ RSpec.describe 'Posts API', type: :request do
tags: 'deprecated_update_tag'
)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json.fetch('errors')).to include(
'tags' => ['廃止済みタグは付与できません.']
)
@@ -1789,7 +1789,7 @@ RSpec.describe 'Posts API', type: :request do
title: 'updated title',
tags: 'nico:nico_tag')
expect(response).to have_http_status(:unprocessable_entity), response.body
expect(response).to have_http_status(:unprocessable_content), response.body
expect(json).to include(
'type' => 'validation_error',
'message' => '入力内容を確認してください.',
@@ -1896,7 +1896,7 @@ RSpec.describe 'Posts API', type: :request do
title: 'updated title',
tags: 'spec_tag' }
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json.fetch('errors')).to be_present
end
end
@@ -1922,7 +1922,7 @@ RSpec.describe 'Posts API', type: :request do
parent_post_ids: 'abc'
)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(post_record.reload.parent_posts.pluck(:id)).to eq([parent_post.id])
end
end
@@ -1948,7 +1948,7 @@ RSpec.describe 'Posts API', type: :request do
parent_post_ids: '999999999'
)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(post_record.reload.parent_posts.pluck(:id)).to eq([parent_post.id])
end
end
@@ -1964,7 +1964,7 @@ RSpec.describe 'Posts API', type: :request do
parent_post_ids: post_record.id.to_s
)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(PostImplication.exists?(
post_id: post_record.id,
@@ -2669,7 +2669,7 @@ RSpec.describe 'Posts API', type: :request do
thumbnail: dummy_upload)
end.not_to change(PostVersion, :count)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end
it 'does not create a version when PUT /posts/:id is invalid' do
@@ -2685,7 +2685,7 @@ RSpec.describe 'Posts API', type: :request do
original_created_before: Time.zone.local(2020, 1, 1, 0, 0, 0).iso8601)
end.not_to change(PostVersion, :count)
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
end
it 'rejects second-bearing original created timestamps on POST /posts' do
@@ -2698,7 +2698,7 @@ RSpec.describe 'Posts API', type: :request do
thumbnail: dummy_upload,
original_created_from: '2020-01-01T00:00:01Z')
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json.fetch('errors')).to include(
'original_created_from' => ['オリジナルの作成日時は分単位で入力してください.']
)
@@ -2715,7 +2715,7 @@ RSpec.describe 'Posts API', type: :request do
thumbnail: dummy_upload,
original_created_before: '2020-01-01T00:00:00.123Z')
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json.fetch('errors')).to include(
'original_created_before' => ['オリジナルの作成日時は分単位で入力してください.']
)
@@ -2733,7 +2733,7 @@ RSpec.describe 'Posts API', type: :request do
original_created_from: '2020-01-01T00:00Z',
original_created_before: '2020-01-01T00:00Z')
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json.fetch('errors')).to include(
'original_created_at' => ['オリジナルの作成日時の順番がをかしぃです.']
)
@@ -2767,7 +2767,7 @@ RSpec.describe 'Posts API', type: :request do
tags: 'spec_tag',
original_created_from: 'not-a-time')
expect(response).to have_http_status(:unprocessable_entity)
expect(response).to have_http_status(:unprocessable_content)
expect(json.fetch('errors')).to include(
'original_created_from' => ['オリジナルの作成日時の形式が不正です.']
)