Skip to content

Commit

Permalink
Add tests for the minimum and maximum length of a quote
Browse files Browse the repository at this point in the history
  • Loading branch information
lef237 committed Dec 4, 2023
1 parent 27a5c82 commit e69ec4d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ ja:
quote:
attributes:
sentence:
too_short: "文が短すぎます。最低限の長さは%{count}文字です"
too_long: "文が長すぎます。最大の長さは%{count}文字です"
too_short: "文が短すぎます。引用文は%{count}文字以上で入力してください"
too_long: "文が長すぎます。引用文は%{count}文字以内で入力してください"
12 changes: 12 additions & 0 deletions spec/system/quote_edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@
expect(page).to have_content('まだ引用はありません')
expect(page).not_to have_content('これはテストの引用文です。')
end

# 0文字の投稿を禁じる
it 'does not create a quote with 0 characters' do
add_quote('', 42)
expect(page).to have_content('引用文は1文字以上で入力してください')
end

# 301文字の投稿を禁じる
it 'does not create a quote with 301 characters' do
add_quote('a' * 301, 42)
expect(page).to have_content('引用文は300文字以内で入力してください')
end
end

private
Expand Down

0 comments on commit e69ec4d

Please sign in to comment.