このコミットが含まれているのは:
2026-06-07 02:01:16 +09:00
コミット be2df723fe
8個のファイルの変更222行の追加47行の削除
+25 -1
ファイルの表示
@@ -28,6 +28,13 @@ RSpec.describe 'Theatres API', type: :request do
)
end
let!(:youtube_post) do
Post.create!(
title: 'youtube post',
url: 'https://www.youtube.com/watch?v=yt123'
)
end
let!(:other_post) do
Post.create!(
title: 'other post',
@@ -286,7 +293,7 @@ RSpec.describe 'Theatres API', type: :request do
.to change { theatre.reload.current_post_id }
expect(response).to have_http_status(:no_content)
expect([niconico_post.id, second_niconico_post.id])
expect([niconico_post.id, second_niconico_post.id, youtube_post.id])
.to include(theatre.reload.current_post_id)
expect(theatre.reload.current_post_started_at)
.to be_within(1.second).of(Time.current)
@@ -294,10 +301,27 @@ RSpec.describe 'Theatres API', type: :request do
end
end
context 'when only a YouTube post is eligible' do
before do
niconico_post.destroy!
second_niconico_post.destroy!
theatre.update!(host_user: member)
sign_in_as(member)
end
it 'sets current_post to the YouTube post' do
do_request
expect(response).to have_http_status(:no_content)
expect(theatre.reload.current_post_id).to eq(youtube_post.id)
end
end
context 'when current user is host and no eligible post exists' do
before do
niconico_post.destroy!
second_niconico_post.destroy!
youtube_post.destroy!
theatre.update!(
host_user: member,
current_post: other_post,