X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/7be823bb11ad2aa93ffd4d85cc7f11469a867fa2..3f26761a26f1ebd8746db166be2d30fd9b7ff7d6:/test/unit/message_test.rb?ds=sidebyside diff --git a/test/unit/message_test.rb b/test/unit/message_test.rb index 863b1a4f2..3da91de38 100644 --- a/test/unit/message_test.rb +++ b/test/unit/message_test.rb @@ -19,18 +19,18 @@ class MessageTest < ActiveSupport::TestCase assert message.errors[:title].any? assert message.errors[:body].any? assert message.errors[:sent_on].any? - assert true, message.message_read + assert !message.message_read end def test_validating_msgs - message = messages(:one) + message = messages(:unread_message) assert message.valid? - massage = messages(:two) + massage = messages(:read_message) assert message.valid? end def test_invalid_send_recipient - message = messages(:one) + message = messages(:unread_message) message.sender = nil message.recipient = nil assert !message.valid? @@ -76,6 +76,9 @@ class MessageTest < ActiveSupport::TestCase db_msg = msg.class.find(msg.id) assert_equal char, db_msg.title, "Database silently truncated message title" + rescue ArgumentError => ex + assert_equal ex.to_s, "invalid byte sequence in UTF-8" + rescue ActiveRecord::RecordInvalid # because we only test invalid sequences it is OK to barf on them end @@ -184,7 +187,7 @@ class MessageTest < ActiveSupport::TestCase private def make_message(char, count) - message = messages(:one) + message = messages(:unread_message) message.title = char * count return message end