このコミットが含まれているのは:
2026-09-24 08:14:17 +09:00
コミット 5d2e85a690
4個のファイルの変更、55行の追加、11行の削除
+31
ファイルの表示
@@ -379,6 +379,37 @@ RSpec.describe 'Tags API', type: :request do
expect(response).to have_http_status(:not_found)
end
end
it 'falls back to ExternalTag when no internal Tag has the id' do
external = create(
:external_tag,
id: Tag.maximum(:id).to_i + 10_000,
name: 'legacy_id_lookup')
get "/tags/#{ external.id }"
expect(response).to have_http_status(:ok)
expect(json).to include(
'id' => external.id,
'name' => 'nico:legacy_id_lookup',
'category' => 'nico')
end
it 'prefers Tag when Tag and ExternalTag have the same id' do
internal = create(:tag, name: 'internal_collision')
create(
:external_tag,
id: internal.id,
name: 'external_collision')
get "/tags/#{ internal.id }"
expect(response).to have_http_status(:ok)
expect(json).to include(
'id' => internal.id,
'name' => 'internal_collision')
expect(json.fetch('category')).not_to eq('nico')
end
end
describe 'GET /tags/autocomplete' do