2016-08-06 12:03:25 -04:00
|
|
|
require "abstract_unit"
|
2008-09-21 11:21:30 -04:00
|
|
|
|
2012-01-05 20:12:46 -05:00
|
|
|
class MultibyteUnicodeDatabaseTest < ActiveSupport::TestCase
|
2010-05-10 09:46:37 -04:00
|
|
|
include ActiveSupport::Multibyte::Unicode
|
|
|
|
|
2008-09-21 11:21:30 -04:00
|
|
|
def setup
|
2010-05-10 09:46:37 -04:00
|
|
|
@ucd = UnicodeDatabase.new
|
2008-09-21 11:21:30 -04:00
|
|
|
end
|
|
|
|
|
2010-05-10 09:46:37 -04:00
|
|
|
UnicodeDatabase::ATTRIBUTES.each do |attribute|
|
2008-09-21 11:21:30 -04:00
|
|
|
define_method "test_lazy_loading_on_attribute_access_of_#{attribute}" do
|
2015-06-11 12:18:33 -04:00
|
|
|
assert_called(@ucd, :load) do
|
|
|
|
@ucd.send(attribute)
|
|
|
|
end
|
2008-09-21 11:21:30 -04:00
|
|
|
end
|
|
|
|
end
|
2010-05-10 09:46:37 -04:00
|
|
|
|
2008-09-21 11:21:30 -04:00
|
|
|
def test_load
|
|
|
|
@ucd.load
|
2010-05-10 09:46:37 -04:00
|
|
|
UnicodeDatabase::ATTRIBUTES.each do |attribute|
|
2008-09-21 11:21:30 -04:00
|
|
|
assert @ucd.send(attribute).length > 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|