File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,12 @@ def formatted_title
1212 return title if has_custom_emoji
1313
1414 # Add preset Emoji to its prefix if title does not have Emoji.
15- emoji = case url
16- when %r{/podcasts/\d +}
15+ emoji = if url . match? ( %r{/podcasts/\d +} )
1716 '📻'
18- when %r{prtimes\. jp}
17+ elsif url . match? ( %r{prtimes\. jp} )
1918 '📢'
19+ elsif title . include? ( '寄贈' )
20+ '🎁'
2021 else
2122 '📰'
2223 end
Original file line number Diff line number Diff line change 8484 end
8585
8686 context '先頭文字が絵文字でない場合' do
87+ it 'タイトルに「寄贈」が含まれる場合は🎁を付与する' do
88+ news = build ( :news , title : 'ノートPC 233台を寄贈しました' , url : 'https://news.coderdojo.jp/2025/12/18/pc-donation' )
89+ expect ( news . formatted_title ) . to eq '🎁 ノートPC 233台を寄贈しました'
90+ end
91+
92+ it 'ポッドキャストURLはタイトルの「寄贈」より優先される' do
93+ news = build ( :news , title : 'ポッドキャストで寄贈について話しました' , url : 'https://coderdojo.jp/podcasts/50' )
94+ expect ( news . formatted_title ) . to eq '📻 ポッドキャストで寄贈について話しました'
95+ end
96+
8797 it 'ポッドキャストのURLには📻を付与する' do
8898 news = build ( :news , title : 'エピソード33' , url : 'https://coderdojo.jp/podcasts/33' )
8999 expect ( news . formatted_title ) . to eq '📻 エピソード33'
You can’t perform that action at this time.
0 commit comments