Skip to content

Commit 776767c

Browse files
committed
feat: 絵文字ヘルパーのテストを追加
- format_news_title メソッドのテストを実装 - 先頭文字が絵文字なら保持、そうでなければ📰を付与
1 parent 21df7e2 commit 776767c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require 'rails_helper'
2+
3+
RSpec.describe ApplicationHelper, type: :helper do
4+
describe '#format_news_title' do
5+
it '先頭文字が絵文字ならそのまま、そうでなければ 📰 を付与する' do
6+
{
7+
'🔔 新着' => '🔔 新着',
8+
'更新情報' => '📰 更新情報',
9+
'1つ目のお知らせ' => '📰 1つ目のお知らせ'
10+
}.each do |input, expected|
11+
news = double('news', title: input)
12+
expect(helper.format_news_title(news)).to eq expected
13+
end
14+
end
15+
end
16+
end

0 commit comments

Comments
 (0)