X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/baf10cd39289cd7e94a819305e46f43e85a136c6..77c25dca8c9b60c2fd8dae6eeee1405ec24edf27:/test/models/message_test.rb diff --git a/test/models/message_test.rb b/test/models/message_test.rb index 5cd171211..a6ae3ecce 100644 --- a/test/models/message_test.rb +++ b/test/models/message_test.rb @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -require 'test_helper' +require "test_helper" class MessageTest < ActiveSupport::TestCase api_fixtures fixtures :messages - EURO = "\xe2\x82\xac" # euro symbol + EURO = "\xe2\x82\xac".freeze # euro symbol # This needs to be updated when new fixtures are added # or removed. @@ -43,19 +43,19 @@ class MessageTest < ActiveSupport::TestCase def test_utf8_roundtrip (1..255).each do |i| - assert_message_ok('c', i) + assert_message_ok("c", i) assert_message_ok(EURO, i) end end def test_length_oversize - assert_raise(ActiveRecord::RecordInvalid) { make_message('c', 256).save! } + assert_raise(ActiveRecord::RecordInvalid) { make_message("c", 256).save! } assert_raise(ActiveRecord::RecordInvalid) { make_message(EURO, 256).save! } end def test_invalid_utf8 # See e.g http://en.wikipedia.org/wiki/UTF-8 for byte sequences - # FIXME - Invalid Unicode characters can still be encoded into "valid" utf-8 byte sequences - maybe check this too? + # FIXME: Invalid Unicode characters can still be encoded into "valid" utf-8 byte sequences - maybe check this too? invalid_sequences = ["\xC0", # always invalid utf8 "\xC2\x4a", # 2-byte multibyte identifier, followed by plain ASCII "\xC2\xC2", # 2-byte multibyte identifier, followed by another one @@ -89,7 +89,7 @@ class MessageTest < ActiveSupport::TestCase to "to@example.com" subject "Test message" date Time.now - content_type 'text/plain; charset=utf-8' + content_type "text/plain; charset=utf-8" body "This is a test & a message" end message = Message.from_mail(mail, users(:normal_user), users(:public_user)) @@ -107,7 +107,7 @@ class MessageTest < ActiveSupport::TestCase to "to@example.com" subject "Test message" date Time.now - content_type 'text/html; charset=utf-8' + content_type "text/html; charset=utf-8" body "

This is a test & a message

" end message = Message.from_mail(mail, users(:normal_user), users(:public_user)) @@ -127,12 +127,12 @@ class MessageTest < ActiveSupport::TestCase date Time.now text_part do - content_type 'text/plain; charset=utf-8' + content_type "text/plain; charset=utf-8" body "This is a test & a message in text format" end html_part do - content_type 'text/html; charset=utf-8' + content_type "text/html; charset=utf-8" body "

This is a test & a message in HTML format

" end end @@ -151,7 +151,7 @@ class MessageTest < ActiveSupport::TestCase date Time.now html_part do - content_type 'text/html; charset=utf-8' + content_type "text/html; charset=utf-8" body "

This is a test & a message in HTML format

" end end @@ -170,7 +170,7 @@ class MessageTest < ActiveSupport::TestCase to "to@example.com" subject "[OpenStreetMap] Test message" date Time.now - content_type 'text/plain; charset=utf-8' + content_type "text/plain; charset=utf-8" body "This is a test & a message" end message = Message.from_mail(mail, users(:normal_user), users(:public_user))