Skip to content

Commit b1e7ffc

Browse files
committed
m:ss形式(一桁の分)のタイムスタンプにも対応するテストを追加
- 既存のコードで m:ss 形式も正しく処理されることを確認 - エピソード21など多くのポッドキャストで使用されている形式 - 0:00, 0:54, 2:10, 9:25 などのパターンをテスト
1 parent 40e4dcc commit b1e7ffc

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

spec/features/podcasts_spec.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,35 @@
9898
expect(page).to have_link '05:45', href: 'https://youtu.be/test123?t=05m45s'
9999
expect(page).to have_link '59:59', href: 'https://youtu.be/test123?t=59m59s'
100100
end
101+
102+
scenario 'Show note timestamps with m:ss format (single digit minutes) are converted to YouTube links' do
103+
@podcast = create(:podcast)
104+
allow(@podcast).to receive(:exist?) { true }
105+
allow(@podcast).to receive(:content) {
106+
<<~CONTENT
107+
タイトル
108+
収録日: 2019/05/10
109+
110+
YouTubeリンク: https://www.youtube.com/watch?v=episode21
111+
112+
## Shownote
113+
114+
- 0:00 ゲスト自己紹介
115+
- 0:54 TFabWorks 無償レンタルプログラム
116+
- 2:10 2019年の年末から動き出した
117+
- 9:25 レンタルの種類
118+
CONTENT
119+
}
120+
allow(Podcast).to receive(:find_by).with(id: @podcast.id.to_s) { @podcast }
121+
122+
visit "/podcasts/#{@podcast.id}"
123+
expect(page).to have_http_status(:success)
124+
125+
# m:ss形式(一桁の分)のタイムスタンプもYouTubeリンクに変換されているか確認
126+
expect(page).to have_link '0:00', href: 'https://youtu.be/episode21?t=0m00s'
127+
expect(page).to have_link '0:54', href: 'https://youtu.be/episode21?t=0m54s'
128+
expect(page).to have_link '2:10', href: 'https://youtu.be/episode21?t=2m10s'
129+
expect(page).to have_link '9:25', href: 'https://youtu.be/episode21?t=9m25s'
130+
end
101131
end
102132
end

0 commit comments

Comments
 (0)