このコミットが含まれているのは:
@@ -71,6 +71,12 @@ class NicoTagsController < ApplicationController
|
|||||||
}, count: }
|
}, count: }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
tag = ExternalTag.find(params[:id])
|
||||||
|
|
||||||
|
render json: external_tag_json(tag)
|
||||||
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
return head :unauthorized unless current_user
|
return head :unauthorized unless current_user
|
||||||
return head :forbidden unless current_user.gte_member?
|
return head :forbidden unless current_user.gte_member?
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
resources :nico_tags, path: 'tags/nico', only: [:index, :update]
|
resources :nico_tags, path: 'tags/nico', only: [:index, :show, :update]
|
||||||
|
|
||||||
scope 'tags/:parent_id/children', controller: :tag_children do
|
scope 'tags/:parent_id/children', controller: :tag_children do
|
||||||
post ':child_id', action: :create
|
post ':child_id', action: :create
|
||||||
|
|||||||
@@ -106,6 +106,32 @@ RSpec.describe 'NicoTags', type: :request do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'GET /tags/nico/:id' do
|
||||||
|
it 'returns the external tag even when an internal tag has the same id' do
|
||||||
|
internal = create(:tag)
|
||||||
|
external = create(
|
||||||
|
:external_tag,
|
||||||
|
id: internal.id,
|
||||||
|
name: 'external_detail')
|
||||||
|
|
||||||
|
get "/tags/nico/#{ external.id }"
|
||||||
|
|
||||||
|
expect(response).to have_http_status(:ok)
|
||||||
|
expect(json).to include(
|
||||||
|
'id' => external.id,
|
||||||
|
'name' => 'nico:external_detail',
|
||||||
|
'category' => 'nico')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns 404 when the external tag does not exist' do
|
||||||
|
internal = create(:tag)
|
||||||
|
|
||||||
|
get "/tags/nico/#{ internal.id }"
|
||||||
|
|
||||||
|
expect(response).to have_http_status(:not_found)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'PATCH /tags/nico/:id' do
|
describe 'PATCH /tags/nico/:id' do
|
||||||
let(:member) { create(:user, :member) }
|
let(:member) { create(:user, :member) }
|
||||||
let(:admin) { create(:user, :admin) }
|
let(:admin) { create(:user, :admin) }
|
||||||
|
|||||||
新しいイシューから参照
ユーザーをブロックする