このコミットが含まれているのは:
@@ -361,6 +361,24 @@ RSpec.describe 'Theatres API', type: :request do
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns 401 when not logged in' do
|
||||
sign_out
|
||||
|
||||
expect { do_request }.not_to change(TheatreSkipVote, :count)
|
||||
|
||||
expect(response).to have_http_status(:unauthorized)
|
||||
end
|
||||
|
||||
it 'returns 422 when post_id is invalid' do
|
||||
sign_in_as(member)
|
||||
|
||||
expect {
|
||||
put "/theatres/#{theatre.id}/skip_vote", params: { post_id: 'invalid' }
|
||||
}.not_to change(TheatreSkipVote, :count)
|
||||
|
||||
expect(response).to have_http_status(:unprocessable_entity)
|
||||
end
|
||||
|
||||
it 'records a vote and returns the current vote status before majority' do
|
||||
sign_in_as(member)
|
||||
|
||||
@@ -391,7 +409,7 @@ RSpec.describe 'Theatres API', type: :request do
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json['skipped']).to eq(true)
|
||||
expect(json['post_id']).to eq(second_niconico_post.id)
|
||||
expect([second_niconico_post.id, youtube_post.id]).to include(json['post_id'])
|
||||
|
||||
event = TheatreSkipEvent.last
|
||||
expect(event.post).to eq(niconico_post)
|
||||
|
||||
新しい課題から参照
ユーザをブロックする