Skip to content

Commit 76202d8

Browse files
committed
test: titleバリデーションの有効ケースを追加
1 parent 7b0b652 commit 76202d8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

spec/models/news_spec.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66

77
describe 'title' do
88
it 'タイトルが空の場合は無効になる' do
9-
news.title = nil
10-
expect(news).not_to be_valid
11-
expect(news.errors[:title]).not_to be_empty
9+
news.title = nil
10+
expect(news).not_to be_valid
11+
expect(news.errors[:title]).not_to be_empty
12+
end
13+
14+
it 'タイトルが正しく設定されている場合は有効になる' do
15+
news.title = '有効なタイトル'
16+
expect(news).to be_valid
1217
end
1318
end
1419

0 commit comments

Comments
 (0)