notes: disallow blank note bodies.

This commit is contained in:
evazion
2017-04-28 19:34:27 -05:00
parent 641f56dc2a
commit a3ecfdb79d
2 changed files with 8 additions and 6 deletions

View File

@@ -67,6 +67,13 @@ class NoteTest < ActiveSupport::TestCase
assert_equal(["Post must exist"], @note.errors.full_messages)
end
should "not validate if the body is blank" do
@note = FactoryGirl.build(:note, body: " ")
assert_equal(false, @note.valid?)
assert_equal(["Body can't be blank"], @note.errors.full_messages)
end
should "create a version" do
assert_difference("NoteVersion.count", 1) do
Timecop.travel(1.day.from_now) do