Sha256: bd41a614e7a9e684de5f83e5add6efc294300d558ed1a9081903bdc9ce0af2ed
Contents?: true
Size: 867 Bytes
Versions: 10
Compression:
Stored size: 867 Bytes
Contents
# encoding: utf-8 require 'test_helper' class BasicMultilingualPlaneValidatorTest < Minitest::Test class Model include ActiveModel::Validations attr_accessor :unicode validates :unicode, basic_multilingual_plane: true end def setup @model = Model.new end def test_basic_multilingual_plane_string @model.unicode = 'basic multilingual ünicode' assert @model.valid? end def test_emoji @model.unicode = '💩' assert @model.invalid? assert_equal ["contains characters outside Unicode's basic multilingual plane"], @model.errors[:unicode] end def test_nil @model.unicode = nil assert @model.valid? end def test_different_type @model.unicode = 1 assert @model.valid? end def test_non_unicode_encoding @model.unicode = 'ü'.encode('ISO-8859-15') assert @model.valid? end end
Version data entries
10 entries across 10 versions & 1 rubygems