このコミットが含まれているのは:
@@ -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
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする