activesupport 3.0.0.beta4 → 3.0.pre
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- data/CHANGELOG +1 -100
- data/lib/active_support.rb +4 -38
- data/lib/active_support/autoload.rb +28 -0
- data/lib/active_support/backtrace_cleaner.rb +9 -31
- data/lib/active_support/benchmarkable.rb +0 -1
- data/lib/active_support/buffered_logger.rb +1 -0
- data/lib/active_support/cache.rb +81 -436
- data/lib/active_support/cache/compressed_mem_cache_store.rb +13 -6
- data/lib/active_support/cache/file_store.rb +41 -139
- data/lib/active_support/cache/mem_cache_store.rb +75 -120
- data/lib/active_support/cache/memory_store.rb +27 -127
- data/lib/active_support/cache/strategy/local_cache.rb +58 -111
- data/lib/active_support/cache/synchronized_memory_store.rb +38 -2
- data/lib/active_support/callbacks.rb +48 -87
- data/lib/active_support/configurable.rb +18 -19
- data/lib/active_support/core_ext/array.rb +0 -1
- data/lib/active_support/core_ext/array/access.rb +1 -1
- data/lib/active_support/core_ext/array/conversions.rb +54 -29
- data/lib/active_support/core_ext/array/extract_options.rb +1 -16
- data/lib/active_support/core_ext/array/random_access.rb +5 -19
- data/lib/active_support/core_ext/array/wrap.rb +9 -13
- data/lib/active_support/core_ext/benchmark.rb +12 -0
- data/lib/active_support/core_ext/boolean.rb +1 -0
- data/lib/active_support/core_ext/boolean/conversions.rb +11 -0
- data/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +0 -2
- data/lib/active_support/core_ext/class.rb +1 -1
- data/lib/active_support/core_ext/class/attribute_accessors.rb +27 -33
- data/lib/active_support/core_ext/class/delegating_attributes.rb +41 -35
- data/lib/active_support/core_ext/class/inheritable_attributes.rb +13 -22
- data/lib/active_support/core_ext/class/removal.rb +53 -0
- data/lib/active_support/core_ext/date.rb +7 -0
- data/lib/active_support/core_ext/date/calculations.rb +8 -30
- data/lib/active_support/core_ext/date/conversions.rb +2 -2
- data/lib/active_support/core_ext/date_time.rb +5 -0
- data/lib/active_support/core_ext/date_time/calculations.rb +1 -2
- data/lib/active_support/core_ext/date_time/conversions.rb +5 -23
- data/lib/active_support/core_ext/enumerable.rb +9 -5
- data/lib/active_support/core_ext/exception.rb +47 -0
- data/lib/active_support/core_ext/file.rb +0 -1
- data/lib/active_support/core_ext/file/atomic.rb +2 -3
- data/lib/active_support/core_ext/float/rounding.rb +2 -3
- data/lib/active_support/core_ext/hash/conversions.rb +145 -65
- data/lib/active_support/core_ext/hash/deep_merge.rb +7 -6
- data/lib/active_support/core_ext/hash/except.rb +0 -8
- data/lib/active_support/core_ext/hash/indifferent_access.rb +0 -5
- data/lib/active_support/core_ext/hash/keys.rb +11 -10
- data/lib/active_support/core_ext/hash/slice.rb +0 -6
- data/lib/active_support/core_ext/integer.rb +1 -1
- data/lib/active_support/core_ext/integer/even_odd.rb +16 -0
- data/lib/active_support/core_ext/kernel.rb +1 -1
- data/lib/active_support/core_ext/kernel/daemonizing.rb +7 -0
- data/lib/active_support/core_ext/kernel/debugger.rb +2 -3
- data/lib/active_support/core_ext/kernel/reporting.rb +1 -2
- data/lib/active_support/core_ext/load_error.rb +30 -17
- data/lib/active_support/core_ext/logger.rb +1 -1
- data/lib/active_support/core_ext/module.rb +3 -5
- data/lib/active_support/core_ext/module/aliasing.rb +1 -1
- data/lib/active_support/core_ext/module/attr_accessor_with_default.rb +1 -1
- data/lib/active_support/core_ext/module/attr_internal.rb +2 -2
- data/lib/active_support/core_ext/module/attribute_accessors.rb +21 -25
- data/lib/active_support/core_ext/module/delegation.rb +10 -21
- data/lib/active_support/core_ext/module/inclusion.rb +30 -0
- data/lib/active_support/core_ext/module/introspection.rb +8 -8
- data/lib/active_support/core_ext/module/loading.rb +23 -0
- data/lib/active_support/core_ext/module/synchronization.rb +1 -2
- data/lib/active_support/core_ext/name_error.rb +1 -3
- data/lib/active_support/core_ext/nil.rb +1 -0
- data/lib/active_support/core_ext/nil/conversions.rb +5 -0
- data/lib/active_support/core_ext/object.rb +2 -6
- data/lib/active_support/core_ext/object/blank.rb +2 -20
- data/lib/active_support/core_ext/object/conversions.rb +16 -2
- data/lib/active_support/core_ext/object/duplicable.rb +1 -23
- data/lib/active_support/core_ext/object/extending.rb +77 -8
- data/lib/active_support/core_ext/object/instance_variables.rb +7 -0
- data/lib/active_support/core_ext/object/metaclass.rb +13 -0
- data/lib/active_support/core_ext/object/misc.rb +1 -0
- data/lib/active_support/core_ext/object/tap.rb +16 -0
- data/lib/active_support/core_ext/object/with_options.rb +0 -2
- data/lib/active_support/core_ext/proc.rb +4 -4
- data/lib/active_support/core_ext/regexp.rb +22 -0
- data/lib/active_support/core_ext/rexml.rb +1 -4
- data/lib/active_support/core_ext/string.rb +2 -3
- data/lib/active_support/core_ext/string/access.rb +2 -4
- data/lib/active_support/core_ext/string/bytesize.rb +5 -0
- data/lib/active_support/core_ext/string/conversions.rb +1 -36
- data/lib/active_support/core_ext/string/filters.rb +0 -29
- data/lib/active_support/core_ext/string/inflections.rb +12 -1
- data/lib/active_support/core_ext/string/interpolation.rb +92 -2
- data/lib/active_support/core_ext/string/iterators.rb +13 -0
- data/lib/active_support/core_ext/string/multibyte.rb +19 -16
- data/lib/active_support/core_ext/string/output_safety.rb +35 -101
- data/lib/active_support/core_ext/string/starts_ends_with.rb +14 -0
- data/lib/active_support/core_ext/string/xchar.rb +1 -1
- data/lib/active_support/core_ext/symbol.rb +1 -0
- data/lib/active_support/core_ext/symbol/to_proc.rb +14 -0
- data/lib/active_support/core_ext/time.rb +10 -0
- data/lib/active_support/core_ext/time/calculations.rb +7 -9
- data/lib/active_support/core_ext/time/conversions.rb +0 -1
- data/lib/active_support/core_ext/time/marshal_with_utc_flag.rb +22 -0
- data/lib/active_support/core_ext/uri.rb +4 -10
- data/lib/active_support/dependencies.rb +192 -179
- data/lib/active_support/deprecated_callbacks.rb +283 -0
- data/lib/active_support/deprecation/behaviors.rb +1 -1
- data/lib/active_support/deprecation/method_wrappers.rb +9 -10
- data/lib/active_support/deprecation/reporting.rb +1 -2
- data/lib/active_support/duration.rb +2 -6
- data/lib/active_support/hash_with_indifferent_access.rb +1 -9
- data/lib/active_support/inflections.rb +1 -1
- data/lib/active_support/inflector.rb +407 -4
- data/lib/active_support/json/backends/jsongem.rb +9 -12
- data/lib/active_support/json/decoding.rb +1 -16
- data/lib/active_support/json/encoding.rb +12 -42
- data/lib/active_support/locale/en.yml +1 -4
- data/lib/active_support/memoizable.rb +1 -1
- data/lib/active_support/message_encryptor.rb +0 -1
- data/lib/active_support/message_verifier.rb +5 -6
- data/lib/active_support/multibyte.rb +22 -7
- data/lib/active_support/multibyte/chars.rb +392 -164
- data/lib/active_support/multibyte/unicode_database.rb +71 -0
- data/lib/active_support/multibyte/utils.rb +7 -6
- data/lib/active_support/notifications.rb +113 -23
- data/lib/active_support/ordered_hash.rb +11 -35
- data/lib/active_support/ordered_options.rb +0 -6
- data/lib/active_support/rescuable.rb +4 -7
- data/lib/active_support/ruby/shim.rb +6 -4
- data/lib/active_support/test_case.rb +7 -2
- data/lib/active_support/testing/assertions.rb +0 -15
- data/lib/active_support/testing/declarative.rb +1 -1
- data/lib/active_support/testing/isolation.rb +19 -63
- data/lib/active_support/testing/performance.rb +337 -342
- data/lib/active_support/testing/setup_and_teardown.rb +29 -51
- data/lib/active_support/time.rb +3 -23
- data/lib/active_support/time_with_zone.rb +10 -5
- data/lib/active_support/values/time_zone.rb +84 -40
- data/lib/active_support/values/unicode_tables.dat +0 -0
- data/lib/active_support/vendor.rb +16 -0
- data/lib/active_support/vendor/builder-2.1.2/lib/blankslate.rb +113 -0
- data/lib/active_support/vendor/builder-2.1.2/lib/builder.rb +13 -0
- data/lib/active_support/vendor/builder-2.1.2/lib/builder/blankslate.rb +20 -0
- data/lib/active_support/vendor/builder-2.1.2/lib/builder/css.rb +250 -0
- data/lib/active_support/vendor/builder-2.1.2/lib/builder/xchar.rb +115 -0
- data/lib/active_support/vendor/builder-2.1.2/lib/builder/xmlbase.rb +139 -0
- data/lib/active_support/vendor/builder-2.1.2/lib/builder/xmlevents.rb +63 -0
- data/lib/active_support/vendor/builder-2.1.2/lib/builder/xmlmarkup.rb +328 -0
- data/lib/active_support/vendor/i18n-0.1.3/MIT-LICENSE +20 -0
- data/lib/active_support/vendor/i18n-0.1.3/README.textile +20 -0
- data/lib/active_support/vendor/i18n-0.1.3/Rakefile +5 -0
- data/lib/active_support/vendor/i18n-0.1.3/i18n.gemspec +27 -0
- data/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb +204 -0
- data/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb +215 -0
- data/lib/active_support/vendor/i18n-0.1.3/lib/i18n/exceptions.rb +53 -0
- data/lib/active_support/vendor/i18n-0.1.3/test/all.rb +5 -0
- data/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb +99 -0
- data/lib/active_support/vendor/i18n-0.1.3/test/i18n_test.rb +124 -0
- data/lib/active_support/vendor/i18n-0.1.3/test/locale/en.rb +1 -0
- data/lib/active_support/vendor/i18n-0.1.3/test/locale/en.yml +3 -0
- data/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb +567 -0
- data/lib/active_support/vendor/memcache-client-1.7.5/lib/memcache.rb +1133 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo.rb +33 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone.rb +47 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone_info.rb +228 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Algiers.rb +55 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Cairo.rb +219 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Casablanca.rb +42 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Harare.rb +18 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Johannesburg.rb +25 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Monrovia.rb +22 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Nairobi.rb +23 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +166 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/San_Juan.rb +86 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Bogota.rb +23 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Caracas.rb +23 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chicago.rb +283 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chihuahua.rb +136 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Denver.rb +204 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Godthab.rb +161 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Guatemala.rb +27 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Halifax.rb +274 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb +149 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Juneau.rb +194 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/La_Paz.rb +22 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Lima.rb +35 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Los_Angeles.rb +232 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mazatlan.rb +139 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mexico_City.rb +144 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Monterrey.rb +131 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/New_York.rb +282 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Phoenix.rb +30 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Regina.rb +74 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Santiago.rb +205 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Sao_Paulo.rb +171 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/St_Johns.rb +288 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Tijuana.rb +196 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Almaty.rb +67 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baghdad.rb +73 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baku.rb +161 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Bangkok.rb +20 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Chongqing.rb +33 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Colombo.rb +30 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Dhaka.rb +27 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Hong_Kong.rb +87 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Irkutsk.rb +165 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jakarta.rb +30 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jerusalem.rb +163 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kabul.rb +20 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kamchatka.rb +163 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Karachi.rb +32 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kathmandu.rb +20 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kolkata.rb +25 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb +163 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb +31 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuwait.rb +18 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Magadan.rb +163 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Muscat.rb +18 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Novosibirsk.rb +164 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Rangoon.rb +24 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Riyadh.rb +18 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Seoul.rb +34 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Shanghai.rb +35 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Singapore.rb +33 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Taipei.rb +59 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tashkent.rb +47 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tbilisi.rb +78 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tehran.rb +121 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tokyo.rb +30 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb +65 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Urumqi.rb +33 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Vladivostok.rb +164 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yakutsk.rb +163 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yekaterinburg.rb +165 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yerevan.rb +165 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Azores.rb +270 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb +23 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/South_Georgia.rb +18 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Adelaide.rb +187 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Brisbane.rb +35 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Darwin.rb +29 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Hobart.rb +193 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Melbourne.rb +185 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Perth.rb +37 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Sydney.rb +185 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Etc/UTC.rb +16 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Amsterdam.rb +228 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Athens.rb +185 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Belgrade.rb +163 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Berlin.rb +188 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bratislava.rb +13 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Brussels.rb +232 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bucharest.rb +181 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Budapest.rb +197 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Copenhagen.rb +179 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Dublin.rb +276 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Helsinki.rb +163 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Istanbul.rb +218 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Kiev.rb +168 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Lisbon.rb +268 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Ljubljana.rb +13 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/London.rb +288 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Madrid.rb +211 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Minsk.rb +170 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Moscow.rb +181 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Paris.rb +232 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Prague.rb +187 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Riga.rb +176 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Rome.rb +215 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sarajevo.rb +13 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Skopje.rb +13 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sofia.rb +173 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Stockholm.rb +165 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Tallinn.rb +172 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vienna.rb +183 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vilnius.rb +170 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Warsaw.rb +212 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Zagreb.rb +13 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Auckland.rb +202 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Fiji.rb +23 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Guam.rb +22 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Honolulu.rb +28 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Majuro.rb +20 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Midway.rb +25 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Noumea.rb +25 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Pago_Pago.rb +26 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Port_Moresby.rb +20 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Tongatapu.rb +27 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/info_timezone.rb +52 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone.rb +51 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone_info.rb +44 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/offset_rationals.rb +98 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/ruby_core_support.rb +56 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/time_or_datetime.rb +292 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone.rb +508 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_definition.rb +56 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_info.rb +40 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_offset_info.rb +94 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_period.rb +198 -0
- data/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_transition_info.rb +129 -0
- data/lib/active_support/version.rb +2 -3
- data/lib/active_support/whiny_nil.rb +7 -9
- data/lib/active_support/xml_mini.rb +1 -126
- data/lib/active_support/xml_mini/jdom.rb +0 -2
- data/lib/active_support/xml_mini/libxml.rb +86 -24
- data/lib/active_support/xml_mini/nokogiri.rb +24 -27
- data/lib/active_support/xml_mini/rexml.rb +1 -7
- metadata +191 -49
- data/lib/active_support/builder.rb +0 -6
- data/lib/active_support/core_ext/array/uniq_by.rb +0 -17
- data/lib/active_support/core_ext/class/attribute.rb +0 -67
- data/lib/active_support/core_ext/class/subclasses.rb +0 -55
- data/lib/active_support/core_ext/file/path.rb +0 -5
- data/lib/active_support/core_ext/integer/multiple.rb +0 -6
- data/lib/active_support/core_ext/kernel/singleton_class.rb +0 -13
- data/lib/active_support/core_ext/module/anonymous.rb +0 -24
- data/lib/active_support/core_ext/module/method_names.rb +0 -14
- data/lib/active_support/core_ext/module/reachable.rb +0 -10
- data/lib/active_support/core_ext/module/remove_method.rb +0 -6
- data/lib/active_support/core_ext/object/to_param.rb +0 -49
- data/lib/active_support/core_ext/object/to_query.rb +0 -27
- data/lib/active_support/core_ext/string/encoding.rb +0 -11
- data/lib/active_support/core_ext/string/exclude.rb +0 -6
- data/lib/active_support/core_ext/time/marshal.rb +0 -56
- data/lib/active_support/dependencies/autoload.rb +0 -50
- data/lib/active_support/i18n.rb +0 -8
- data/lib/active_support/inflector/inflections.rb +0 -211
- data/lib/active_support/inflector/methods.rb +0 -141
- data/lib/active_support/inflector/transliterate.rb +0 -97
- data/lib/active_support/json/backends/yajl.rb +0 -40
- data/lib/active_support/lazy_load_hooks.rb +0 -27
- data/lib/active_support/multibyte/unicode.rb +0 -393
- data/lib/active_support/notifications/fanout.rb +0 -93
- data/lib/active_support/notifications/instrumenter.rb +0 -56
- data/lib/active_support/railtie.rb +0 -100
- data/lib/active_support/xml_mini/libxmlsax.rb +0 -85
- data/lib/active_support/xml_mini/nokogirisax.rb +0 -83
@@ -0,0 +1,99 @@
|
|
1
|
+
$:.unshift "lib"
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'test/unit'
|
5
|
+
require 'i18n'
|
6
|
+
require 'active_support'
|
7
|
+
|
8
|
+
class I18nExceptionsTest < Test::Unit::TestCase
|
9
|
+
def test_invalid_locale_stores_locale
|
10
|
+
force_invalid_locale
|
11
|
+
rescue I18n::ArgumentError => e
|
12
|
+
assert_nil e.locale
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_invalid_locale_message
|
16
|
+
force_invalid_locale
|
17
|
+
rescue I18n::ArgumentError => e
|
18
|
+
assert_equal 'nil is not a valid locale', e.message
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_missing_translation_data_stores_locale_key_and_options
|
22
|
+
force_missing_translation_data
|
23
|
+
rescue I18n::ArgumentError => e
|
24
|
+
options = {:scope => :bar}
|
25
|
+
assert_equal 'de', e.locale
|
26
|
+
assert_equal :foo, e.key
|
27
|
+
assert_equal options, e.options
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_missing_translation_data_message
|
31
|
+
force_missing_translation_data
|
32
|
+
rescue I18n::ArgumentError => e
|
33
|
+
assert_equal 'translation missing: de, bar, foo', e.message
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_invalid_pluralization_data_stores_entry_and_count
|
37
|
+
force_invalid_pluralization_data
|
38
|
+
rescue I18n::ArgumentError => e
|
39
|
+
assert_equal [:bar], e.entry
|
40
|
+
assert_equal 1, e.count
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_invalid_pluralization_data_message
|
44
|
+
force_invalid_pluralization_data
|
45
|
+
rescue I18n::ArgumentError => e
|
46
|
+
assert_equal 'translation data [:bar] can not be used with :count => 1', e.message
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_missing_interpolation_argument_stores_key_and_string
|
50
|
+
force_missing_interpolation_argument
|
51
|
+
rescue I18n::ArgumentError => e
|
52
|
+
assert_equal 'bar', e.key
|
53
|
+
assert_equal "{{bar}}", e.string
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_missing_interpolation_argument_message
|
57
|
+
force_missing_interpolation_argument
|
58
|
+
rescue I18n::ArgumentError => e
|
59
|
+
assert_equal 'interpolation argument bar missing in "{{bar}}"', e.message
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_reserved_interpolation_key_stores_key_and_string
|
63
|
+
force_reserved_interpolation_key
|
64
|
+
rescue I18n::ArgumentError => e
|
65
|
+
assert_equal 'scope', e.key
|
66
|
+
assert_equal "{{scope}}", e.string
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_reserved_interpolation_key_message
|
70
|
+
force_reserved_interpolation_key
|
71
|
+
rescue I18n::ArgumentError => e
|
72
|
+
assert_equal 'reserved key "scope" used in "{{scope}}"', e.message
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
def force_invalid_locale
|
77
|
+
I18n.backend.translate nil, :foo
|
78
|
+
end
|
79
|
+
|
80
|
+
def force_missing_translation_data
|
81
|
+
I18n.backend.store_translations 'de', :bar => nil
|
82
|
+
I18n.backend.translate 'de', :foo, :scope => :bar
|
83
|
+
end
|
84
|
+
|
85
|
+
def force_invalid_pluralization_data
|
86
|
+
I18n.backend.store_translations 'de', :foo => [:bar]
|
87
|
+
I18n.backend.translate 'de', :foo, :count => 1
|
88
|
+
end
|
89
|
+
|
90
|
+
def force_missing_interpolation_argument
|
91
|
+
I18n.backend.store_translations 'de', :foo => "{{bar}}"
|
92
|
+
I18n.backend.translate 'de', :foo, :baz => 'baz'
|
93
|
+
end
|
94
|
+
|
95
|
+
def force_reserved_interpolation_key
|
96
|
+
I18n.backend.store_translations 'de', :foo => "{{scope}}"
|
97
|
+
I18n.backend.translate 'de', :foo, :baz => 'baz'
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
$:.unshift "lib"
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'test/unit'
|
5
|
+
require 'i18n'
|
6
|
+
require 'active_support'
|
7
|
+
|
8
|
+
class I18nTest < Test::Unit::TestCase
|
9
|
+
def setup
|
10
|
+
I18n.backend.store_translations :'en', {
|
11
|
+
:currency => {
|
12
|
+
:format => {
|
13
|
+
:separator => '.',
|
14
|
+
:delimiter => ',',
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_uses_simple_backend_set_by_default
|
21
|
+
assert I18n.backend.is_a?(I18n::Backend::Simple)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_can_set_backend
|
25
|
+
assert_nothing_raised{ I18n.backend = self }
|
26
|
+
assert_equal self, I18n.backend
|
27
|
+
I18n.backend = I18n::Backend::Simple.new
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_uses_en_us_as_default_locale_by_default
|
31
|
+
assert_equal 'en', I18n.default_locale
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_can_set_default_locale
|
35
|
+
assert_nothing_raised{ I18n.default_locale = 'de' }
|
36
|
+
assert_equal 'de', I18n.default_locale
|
37
|
+
I18n.default_locale = 'en'
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_uses_default_locale_as_locale_by_default
|
41
|
+
assert_equal I18n.default_locale, I18n.locale
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_can_set_locale_to_thread_current
|
45
|
+
assert_nothing_raised{ I18n.locale = 'de' }
|
46
|
+
assert_equal 'de', I18n.locale
|
47
|
+
assert_equal 'de', Thread.current[:locale]
|
48
|
+
I18n.locale = 'en'
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_can_set_exception_handler
|
52
|
+
assert_nothing_raised{ I18n.exception_handler = :custom_exception_handler }
|
53
|
+
I18n.exception_handler = :default_exception_handler # revert it
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_uses_custom_exception_handler
|
57
|
+
I18n.exception_handler = :custom_exception_handler
|
58
|
+
I18n.expects(:custom_exception_handler)
|
59
|
+
I18n.translate :bogus
|
60
|
+
I18n.exception_handler = :default_exception_handler # revert it
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_delegates_translate_to_backend
|
64
|
+
I18n.backend.expects(:translate).with 'de', :foo, {}
|
65
|
+
I18n.translate :foo, :locale => 'de'
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_delegates_localize_to_backend
|
69
|
+
I18n.backend.expects(:localize).with 'de', :whatever, :default
|
70
|
+
I18n.localize :whatever, :locale => 'de'
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_translate_given_no_locale_uses_i18n_locale
|
74
|
+
I18n.backend.expects(:translate).with 'en', :foo, {}
|
75
|
+
I18n.translate :foo
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_translate_on_nested_symbol_keys_works
|
79
|
+
assert_equal ".", I18n.t(:'currency.format.separator')
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_translate_with_nested_string_keys_works
|
83
|
+
assert_equal ".", I18n.t('currency.format.separator')
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_translate_with_array_as_scope_works
|
87
|
+
assert_equal ".", I18n.t(:separator, :scope => ['currency.format'])
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_translate_with_array_containing_dot_separated_strings_as_scope_works
|
91
|
+
assert_equal ".", I18n.t(:separator, :scope => ['currency.format'])
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_translate_with_key_array_and_dot_separated_scope_works
|
95
|
+
assert_equal [".", ","], I18n.t(%w(separator delimiter), :scope => 'currency.format')
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_translate_with_dot_separated_key_array_and_scope_works
|
99
|
+
assert_equal [".", ","], I18n.t(%w(format.separator format.delimiter), :scope => 'currency')
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_translate_with_options_using_scope_works
|
103
|
+
I18n.backend.expects(:translate).with('de', :precision, :scope => :"currency.format")
|
104
|
+
I18n.with_options :locale => 'de', :scope => :'currency.format' do |locale|
|
105
|
+
locale.t :precision
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# def test_translate_given_no_args_raises_missing_translation_data
|
110
|
+
# assert_equal "translation missing: en, no key", I18n.t
|
111
|
+
# end
|
112
|
+
|
113
|
+
def test_translate_given_a_bogus_key_raises_missing_translation_data
|
114
|
+
assert_equal "translation missing: en, bogus", I18n.t(:bogus)
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_localize_nil_raises_argument_error
|
118
|
+
assert_raise(I18n::ArgumentError) { I18n.l nil }
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_localize_object_raises_argument_error
|
122
|
+
assert_raise(I18n::ArgumentError) { I18n.l Object.new }
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{:'en-Ruby' => {:foo => {:bar => "baz"}}}
|
@@ -0,0 +1,567 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$:.unshift "lib"
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'test/unit'
|
6
|
+
require 'i18n'
|
7
|
+
require 'time'
|
8
|
+
require 'yaml'
|
9
|
+
|
10
|
+
module I18nSimpleBackendTestSetup
|
11
|
+
def setup_backend
|
12
|
+
# backend_reset_translations!
|
13
|
+
@backend = I18n::Backend::Simple.new
|
14
|
+
@backend.store_translations 'en', :foo => {:bar => 'bar', :baz => 'baz'}
|
15
|
+
@locale_dir = File.dirname(__FILE__) + '/locale'
|
16
|
+
end
|
17
|
+
alias :setup :setup_backend
|
18
|
+
|
19
|
+
# def backend_reset_translations!
|
20
|
+
# I18n::Backend::Simple::ClassMethods.send :class_variable_set, :@@translations, {}
|
21
|
+
# end
|
22
|
+
|
23
|
+
def backend_get_translations
|
24
|
+
# I18n::Backend::Simple::ClassMethods.send :class_variable_get, :@@translations
|
25
|
+
@backend.instance_variable_get :@translations
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_datetime_translations
|
29
|
+
@backend.store_translations :'de', {
|
30
|
+
:date => {
|
31
|
+
:formats => {
|
32
|
+
:default => "%d.%m.%Y",
|
33
|
+
:short => "%d. %b",
|
34
|
+
:long => "%d. %B %Y",
|
35
|
+
},
|
36
|
+
:day_names => %w(Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag),
|
37
|
+
:abbr_day_names => %w(So Mo Di Mi Do Fr Sa),
|
38
|
+
:month_names => %w(Januar Februar März April Mai Juni Juli August September Oktober November Dezember).unshift(nil),
|
39
|
+
:abbr_month_names => %w(Jan Feb Mar Apr Mai Jun Jul Aug Sep Okt Nov Dez).unshift(nil),
|
40
|
+
:order => [:day, :month, :year]
|
41
|
+
},
|
42
|
+
:time => {
|
43
|
+
:formats => {
|
44
|
+
:default => "%a, %d. %b %Y %H:%M:%S %z",
|
45
|
+
:short => "%d. %b %H:%M",
|
46
|
+
:long => "%d. %B %Y %H:%M",
|
47
|
+
},
|
48
|
+
:am => 'am',
|
49
|
+
:pm => 'pm'
|
50
|
+
},
|
51
|
+
:datetime => {
|
52
|
+
:distance_in_words => {
|
53
|
+
:half_a_minute => 'half a minute',
|
54
|
+
:less_than_x_seconds => {
|
55
|
+
:one => 'less than 1 second',
|
56
|
+
:other => 'less than {{count}} seconds'
|
57
|
+
},
|
58
|
+
:x_seconds => {
|
59
|
+
:one => '1 second',
|
60
|
+
:other => '{{count}} seconds'
|
61
|
+
},
|
62
|
+
:less_than_x_minutes => {
|
63
|
+
:one => 'less than a minute',
|
64
|
+
:other => 'less than {{count}} minutes'
|
65
|
+
},
|
66
|
+
:x_minutes => {
|
67
|
+
:one => '1 minute',
|
68
|
+
:other => '{{count}} minutes'
|
69
|
+
},
|
70
|
+
:about_x_hours => {
|
71
|
+
:one => 'about 1 hour',
|
72
|
+
:other => 'about {{count}} hours'
|
73
|
+
},
|
74
|
+
:x_days => {
|
75
|
+
:one => '1 day',
|
76
|
+
:other => '{{count}} days'
|
77
|
+
},
|
78
|
+
:about_x_months => {
|
79
|
+
:one => 'about 1 month',
|
80
|
+
:other => 'about {{count}} months'
|
81
|
+
},
|
82
|
+
:x_months => {
|
83
|
+
:one => '1 month',
|
84
|
+
:other => '{{count}} months'
|
85
|
+
},
|
86
|
+
:about_x_years => {
|
87
|
+
:one => 'about 1 year',
|
88
|
+
:other => 'about {{count}} year'
|
89
|
+
},
|
90
|
+
:over_x_years => {
|
91
|
+
:one => 'over 1 year',
|
92
|
+
:other => 'over {{count}} years'
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
class I18nSimpleBackendTranslationsTest < Test::Unit::TestCase
|
101
|
+
include I18nSimpleBackendTestSetup
|
102
|
+
|
103
|
+
def test_store_translations_adds_translations # no, really :-)
|
104
|
+
@backend.store_translations :'en', :foo => 'bar'
|
105
|
+
assert_equal Hash[:'en', {:foo => 'bar'}], backend_get_translations
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_store_translations_deep_merges_translations
|
109
|
+
@backend.store_translations :'en', :foo => {:bar => 'bar'}
|
110
|
+
@backend.store_translations :'en', :foo => {:baz => 'baz'}
|
111
|
+
assert_equal Hash[:'en', {:foo => {:bar => 'bar', :baz => 'baz'}}], backend_get_translations
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_store_translations_forces_locale_to_sym
|
115
|
+
@backend.store_translations 'en', :foo => 'bar'
|
116
|
+
assert_equal Hash[:'en', {:foo => 'bar'}], backend_get_translations
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_store_translations_converts_keys_to_symbols
|
120
|
+
# backend_reset_translations!
|
121
|
+
@backend.store_translations 'en', 'foo' => {'bar' => 'bar', 'baz' => 'baz'}
|
122
|
+
assert_equal Hash[:'en', {:foo => {:bar => 'bar', :baz => 'baz'}}], backend_get_translations
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
class I18nSimpleBackendAvailableLocalesTest < Test::Unit::TestCase
|
127
|
+
def test_available_locales
|
128
|
+
@backend = I18n::Backend::Simple.new
|
129
|
+
@backend.store_translations 'de', :foo => 'bar'
|
130
|
+
@backend.store_translations 'en', :foo => 'foo'
|
131
|
+
|
132
|
+
assert_equal ['de', 'en'], @backend.available_locales.map{|locale| locale.to_s }.sort
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
class I18nSimpleBackendTranslateTest < Test::Unit::TestCase
|
137
|
+
include I18nSimpleBackendTestSetup
|
138
|
+
|
139
|
+
def test_translate_calls_lookup_with_locale_given
|
140
|
+
@backend.expects(:lookup).with('de', :bar, [:foo]).returns 'bar'
|
141
|
+
@backend.translate 'de', :bar, :scope => [:foo]
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_given_no_keys_it_returns_the_default
|
145
|
+
assert_equal 'default', @backend.translate('en', nil, :default => 'default')
|
146
|
+
end
|
147
|
+
|
148
|
+
def test_translate_given_a_symbol_as_a_default_translates_the_symbol
|
149
|
+
assert_equal 'bar', @backend.translate('en', nil, :scope => [:foo], :default => :bar)
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_translate_given_an_array_as_default_uses_the_first_match
|
153
|
+
assert_equal 'bar', @backend.translate('en', :does_not_exist, :scope => [:foo], :default => [:does_not_exist_2, :bar])
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_translate_given_an_array_of_inexistent_keys_it_raises_missing_translation_data
|
157
|
+
assert_raise I18n::MissingTranslationData do
|
158
|
+
@backend.translate('en', :does_not_exist, :scope => [:foo], :default => [:does_not_exist_2, :does_not_exist_3])
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_translate_an_array_of_keys_translates_all_of_them
|
163
|
+
assert_equal %w(bar baz), @backend.translate('en', [:bar, :baz], :scope => [:foo])
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_translate_calls_pluralize
|
167
|
+
@backend.expects(:pluralize).with 'en', 'bar', 1
|
168
|
+
@backend.translate 'en', :bar, :scope => [:foo], :count => 1
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_translate_calls_interpolate
|
172
|
+
@backend.expects(:interpolate).with 'en', 'bar', {}
|
173
|
+
@backend.translate 'en', :bar, :scope => [:foo]
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_translate_calls_interpolate_including_count_as_a_value
|
177
|
+
@backend.expects(:interpolate).with 'en', 'bar', {:count => 1}
|
178
|
+
@backend.translate 'en', :bar, :scope => [:foo], :count => 1
|
179
|
+
end
|
180
|
+
|
181
|
+
def test_translate_given_nil_as_a_locale_raises_an_argument_error
|
182
|
+
assert_raise(I18n::InvalidLocale){ @backend.translate nil, :bar }
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_translate_with_a_bogus_key_and_no_default_raises_missing_translation_data
|
186
|
+
assert_raise(I18n::MissingTranslationData){ @backend.translate 'de', :bogus }
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
class I18nSimpleBackendLookupTest < Test::Unit::TestCase
|
191
|
+
include I18nSimpleBackendTestSetup
|
192
|
+
|
193
|
+
# useful because this way we can use the backend with no key for interpolation/pluralization
|
194
|
+
def test_lookup_given_nil_as_a_key_returns_nil
|
195
|
+
assert_nil @backend.send(:lookup, 'en', nil)
|
196
|
+
end
|
197
|
+
|
198
|
+
def test_lookup_given_nested_keys_looks_up_a_nested_hash_value
|
199
|
+
assert_equal 'bar', @backend.send(:lookup, 'en', :bar, [:foo])
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
class I18nSimpleBackendPluralizeTest < Test::Unit::TestCase
|
204
|
+
include I18nSimpleBackendTestSetup
|
205
|
+
|
206
|
+
def test_pluralize_given_nil_returns_the_given_entry
|
207
|
+
entry = {:one => 'bar', :other => 'bars'}
|
208
|
+
assert_equal entry, @backend.send(:pluralize, nil, entry, nil)
|
209
|
+
end
|
210
|
+
|
211
|
+
def test_pluralize_given_0_returns_zero_string_if_zero_key_given
|
212
|
+
assert_equal 'zero', @backend.send(:pluralize, nil, {:zero => 'zero', :one => 'bar', :other => 'bars'}, 0)
|
213
|
+
end
|
214
|
+
|
215
|
+
def test_pluralize_given_0_returns_plural_string_if_no_zero_key_given
|
216
|
+
assert_equal 'bars', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 0)
|
217
|
+
end
|
218
|
+
|
219
|
+
def test_pluralize_given_1_returns_singular_string
|
220
|
+
assert_equal 'bar', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 1)
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_pluralize_given_2_returns_plural_string
|
224
|
+
assert_equal 'bars', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 2)
|
225
|
+
end
|
226
|
+
|
227
|
+
def test_pluralize_given_3_returns_plural_string
|
228
|
+
assert_equal 'bars', @backend.send(:pluralize, nil, {:one => 'bar', :other => 'bars'}, 3)
|
229
|
+
end
|
230
|
+
|
231
|
+
def test_interpolate_given_incomplete_pluralization_data_raises_invalid_pluralization_data
|
232
|
+
assert_raise(I18n::InvalidPluralizationData){ @backend.send(:pluralize, nil, {:one => 'bar'}, 2) }
|
233
|
+
end
|
234
|
+
|
235
|
+
# def test_interpolate_given_a_string_raises_invalid_pluralization_data
|
236
|
+
# assert_raise(I18n::InvalidPluralizationData){ @backend.send(:pluralize, nil, 'bar', 2) }
|
237
|
+
# end
|
238
|
+
#
|
239
|
+
# def test_interpolate_given_an_array_raises_invalid_pluralization_data
|
240
|
+
# assert_raise(I18n::InvalidPluralizationData){ @backend.send(:pluralize, nil, ['bar'], 2) }
|
241
|
+
# end
|
242
|
+
end
|
243
|
+
|
244
|
+
class I18nSimpleBackendInterpolateTest < Test::Unit::TestCase
|
245
|
+
include I18nSimpleBackendTestSetup
|
246
|
+
|
247
|
+
def test_interpolate_given_a_value_hash_interpolates_the_values_to_the_string
|
248
|
+
assert_equal 'Hi David!', @backend.send(:interpolate, nil, 'Hi {{name}}!', :name => 'David')
|
249
|
+
end
|
250
|
+
|
251
|
+
def test_interpolate_given_a_value_hash_interpolates_into_unicode_string
|
252
|
+
assert_equal 'Häi David!', @backend.send(:interpolate, nil, 'Häi {{name}}!', :name => 'David')
|
253
|
+
end
|
254
|
+
|
255
|
+
def test_interpolate_given_an_unicode_value_hash_interpolates_to_the_string
|
256
|
+
assert_equal 'Hi ゆきひろ!', @backend.send(:interpolate, nil, 'Hi {{name}}!', :name => 'ゆきひろ')
|
257
|
+
end
|
258
|
+
|
259
|
+
def test_interpolate_given_an_unicode_value_hash_interpolates_into_unicode_string
|
260
|
+
assert_equal 'こんにちは、ゆきひろさん!', @backend.send(:interpolate, nil, 'こんにちは、{{name}}さん!', :name => 'ゆきひろ')
|
261
|
+
end
|
262
|
+
|
263
|
+
if Kernel.const_defined?(:Encoding)
|
264
|
+
def test_interpolate_given_a_non_unicode_multibyte_value_hash_interpolates_into_a_string_with_the_same_encoding
|
265
|
+
assert_equal euc_jp('Hi ゆきひろ!'), @backend.send(:interpolate, nil, 'Hi {{name}}!', :name => euc_jp('ゆきひろ'))
|
266
|
+
end
|
267
|
+
|
268
|
+
def test_interpolate_given_an_unicode_value_hash_into_a_non_unicode_multibyte_string_raises_encoding_compatibility_error
|
269
|
+
assert_raise(Encoding::CompatibilityError) do
|
270
|
+
@backend.send(:interpolate, nil, euc_jp('こんにちは、{{name}}さん!'), :name => 'ゆきひろ')
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
def test_interpolate_given_a_non_unicode_multibyte_value_hash_into_an_unicode_string_raises_encoding_compatibility_error
|
275
|
+
assert_raise(Encoding::CompatibilityError) do
|
276
|
+
@backend.send(:interpolate, nil, 'こんにちは、{{name}}さん!', :name => euc_jp('ゆきひろ'))
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
def test_interpolate_given_nil_as_a_string_returns_nil
|
282
|
+
assert_nil @backend.send(:interpolate, nil, nil, :name => 'David')
|
283
|
+
end
|
284
|
+
|
285
|
+
def test_interpolate_given_an_non_string_as_a_string_returns_nil
|
286
|
+
assert_equal [], @backend.send(:interpolate, nil, [], :name => 'David')
|
287
|
+
end
|
288
|
+
|
289
|
+
def test_interpolate_given_a_values_hash_with_nil_values_interpolates_the_string
|
290
|
+
assert_equal 'Hi !', @backend.send(:interpolate, nil, 'Hi {{name}}!', {:name => nil})
|
291
|
+
end
|
292
|
+
|
293
|
+
def test_interpolate_given_an_empty_values_hash_raises_missing_interpolation_argument
|
294
|
+
assert_raise(I18n::MissingInterpolationArgument) { @backend.send(:interpolate, nil, 'Hi {{name}}!', {}) }
|
295
|
+
end
|
296
|
+
|
297
|
+
def test_interpolate_given_a_string_containing_a_reserved_key_raises_reserved_interpolation_key
|
298
|
+
assert_raise(I18n::ReservedInterpolationKey) { @backend.send(:interpolate, nil, '{{default}}', {:default => nil}) }
|
299
|
+
end
|
300
|
+
|
301
|
+
private
|
302
|
+
|
303
|
+
def euc_jp(string)
|
304
|
+
string.encode!(Encoding::EUC_JP)
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
class I18nSimpleBackendLocalizeDateTest < Test::Unit::TestCase
|
309
|
+
include I18nSimpleBackendTestSetup
|
310
|
+
|
311
|
+
def setup
|
312
|
+
@backend = I18n::Backend::Simple.new
|
313
|
+
add_datetime_translations
|
314
|
+
@date = Date.new 2008, 1, 1
|
315
|
+
end
|
316
|
+
|
317
|
+
def test_translate_given_the_short_format_it_uses_it
|
318
|
+
assert_equal '01. Jan', @backend.localize('de', @date, :short)
|
319
|
+
end
|
320
|
+
|
321
|
+
def test_translate_given_the_long_format_it_uses_it
|
322
|
+
assert_equal '01. Januar 2008', @backend.localize('de', @date, :long)
|
323
|
+
end
|
324
|
+
|
325
|
+
def test_translate_given_the_default_format_it_uses_it
|
326
|
+
assert_equal '01.01.2008', @backend.localize('de', @date, :default)
|
327
|
+
end
|
328
|
+
|
329
|
+
def test_translate_given_a_day_name_format_it_returns_a_day_name
|
330
|
+
assert_equal 'Dienstag', @backend.localize('de', @date, '%A')
|
331
|
+
end
|
332
|
+
|
333
|
+
def test_translate_given_an_abbr_day_name_format_it_returns_an_abbrevated_day_name
|
334
|
+
assert_equal 'Di', @backend.localize('de', @date, '%a')
|
335
|
+
end
|
336
|
+
|
337
|
+
def test_translate_given_a_month_name_format_it_returns_a_month_name
|
338
|
+
assert_equal 'Januar', @backend.localize('de', @date, '%B')
|
339
|
+
end
|
340
|
+
|
341
|
+
def test_translate_given_an_abbr_month_name_format_it_returns_an_abbrevated_month_name
|
342
|
+
assert_equal 'Jan', @backend.localize('de', @date, '%b')
|
343
|
+
end
|
344
|
+
|
345
|
+
def test_translate_given_no_format_it_does_not_fail
|
346
|
+
assert_nothing_raised{ @backend.localize 'de', @date }
|
347
|
+
end
|
348
|
+
|
349
|
+
def test_translate_given_an_unknown_format_it_does_not_fail
|
350
|
+
assert_nothing_raised{ @backend.localize 'de', @date, '%x' }
|
351
|
+
end
|
352
|
+
|
353
|
+
def test_localize_nil_raises_argument_error
|
354
|
+
assert_raise(I18n::ArgumentError) { @backend.localize 'de', nil }
|
355
|
+
end
|
356
|
+
|
357
|
+
def test_localize_object_raises_argument_error
|
358
|
+
assert_raise(I18n::ArgumentError) { @backend.localize 'de', Object.new }
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
class I18nSimpleBackendLocalizeDateTimeTest < Test::Unit::TestCase
|
363
|
+
include I18nSimpleBackendTestSetup
|
364
|
+
|
365
|
+
def setup
|
366
|
+
@backend = I18n::Backend::Simple.new
|
367
|
+
add_datetime_translations
|
368
|
+
@morning = DateTime.new 2008, 1, 1, 6
|
369
|
+
@evening = DateTime.new 2008, 1, 1, 18
|
370
|
+
end
|
371
|
+
|
372
|
+
def test_translate_given_the_short_format_it_uses_it
|
373
|
+
assert_equal '01. Jan 06:00', @backend.localize('de', @morning, :short)
|
374
|
+
end
|
375
|
+
|
376
|
+
def test_translate_given_the_long_format_it_uses_it
|
377
|
+
assert_equal '01. Januar 2008 06:00', @backend.localize('de', @morning, :long)
|
378
|
+
end
|
379
|
+
|
380
|
+
def test_translate_given_the_default_format_it_uses_it
|
381
|
+
assert_equal 'Di, 01. Jan 2008 06:00:00 +0000', @backend.localize('de', @morning, :default)
|
382
|
+
end
|
383
|
+
|
384
|
+
def test_translate_given_a_day_name_format_it_returns_the_correct_day_name
|
385
|
+
assert_equal 'Dienstag', @backend.localize('de', @morning, '%A')
|
386
|
+
end
|
387
|
+
|
388
|
+
def test_translate_given_an_abbr_day_name_format_it_returns_the_correct_abbrevated_day_name
|
389
|
+
assert_equal 'Di', @backend.localize('de', @morning, '%a')
|
390
|
+
end
|
391
|
+
|
392
|
+
def test_translate_given_a_month_name_format_it_returns_the_correct_month_name
|
393
|
+
assert_equal 'Januar', @backend.localize('de', @morning, '%B')
|
394
|
+
end
|
395
|
+
|
396
|
+
def test_translate_given_an_abbr_month_name_format_it_returns_the_correct_abbrevated_month_name
|
397
|
+
assert_equal 'Jan', @backend.localize('de', @morning, '%b')
|
398
|
+
end
|
399
|
+
|
400
|
+
def test_translate_given_a_meridian_indicator_format_it_returns_the_correct_meridian_indicator
|
401
|
+
assert_equal 'am', @backend.localize('de', @morning, '%p')
|
402
|
+
assert_equal 'pm', @backend.localize('de', @evening, '%p')
|
403
|
+
end
|
404
|
+
|
405
|
+
def test_translate_given_no_format_it_does_not_fail
|
406
|
+
assert_nothing_raised{ @backend.localize 'de', @morning }
|
407
|
+
end
|
408
|
+
|
409
|
+
def test_translate_given_an_unknown_format_it_does_not_fail
|
410
|
+
assert_nothing_raised{ @backend.localize 'de', @morning, '%x' }
|
411
|
+
end
|
412
|
+
end
|
413
|
+
|
414
|
+
class I18nSimpleBackendLocalizeTimeTest < Test::Unit::TestCase
|
415
|
+
include I18nSimpleBackendTestSetup
|
416
|
+
|
417
|
+
def setup
|
418
|
+
@old_timezone, ENV['TZ'] = ENV['TZ'], 'UTC'
|
419
|
+
@backend = I18n::Backend::Simple.new
|
420
|
+
add_datetime_translations
|
421
|
+
@morning = Time.parse '2008-01-01 6:00 UTC'
|
422
|
+
@evening = Time.parse '2008-01-01 18:00 UTC'
|
423
|
+
end
|
424
|
+
|
425
|
+
def teardown
|
426
|
+
@old_timezone ? ENV['TZ'] = @old_timezone : ENV.delete('TZ')
|
427
|
+
end
|
428
|
+
|
429
|
+
def test_translate_given_the_short_format_it_uses_it
|
430
|
+
assert_equal '01. Jan 06:00', @backend.localize('de', @morning, :short)
|
431
|
+
end
|
432
|
+
|
433
|
+
def test_translate_given_the_long_format_it_uses_it
|
434
|
+
assert_equal '01. Januar 2008 06:00', @backend.localize('de', @morning, :long)
|
435
|
+
end
|
436
|
+
|
437
|
+
# TODO Seems to break on Windows because ENV['TZ'] is ignored. What's a better way to do this?
|
438
|
+
# def test_translate_given_the_default_format_it_uses_it
|
439
|
+
# assert_equal 'Di, 01. Jan 2008 06:00:00 +0000', @backend.localize('de', @morning, :default)
|
440
|
+
# end
|
441
|
+
|
442
|
+
def test_translate_given_a_day_name_format_it_returns_the_correct_day_name
|
443
|
+
assert_equal 'Dienstag', @backend.localize('de', @morning, '%A')
|
444
|
+
end
|
445
|
+
|
446
|
+
def test_translate_given_an_abbr_day_name_format_it_returns_the_correct_abbrevated_day_name
|
447
|
+
assert_equal 'Di', @backend.localize('de', @morning, '%a')
|
448
|
+
end
|
449
|
+
|
450
|
+
def test_translate_given_a_month_name_format_it_returns_the_correct_month_name
|
451
|
+
assert_equal 'Januar', @backend.localize('de', @morning, '%B')
|
452
|
+
end
|
453
|
+
|
454
|
+
def test_translate_given_an_abbr_month_name_format_it_returns_the_correct_abbrevated_month_name
|
455
|
+
assert_equal 'Jan', @backend.localize('de', @morning, '%b')
|
456
|
+
end
|
457
|
+
|
458
|
+
def test_translate_given_a_meridian_indicator_format_it_returns_the_correct_meridian_indicator
|
459
|
+
assert_equal 'am', @backend.localize('de', @morning, '%p')
|
460
|
+
assert_equal 'pm', @backend.localize('de', @evening, '%p')
|
461
|
+
end
|
462
|
+
|
463
|
+
def test_translate_given_no_format_it_does_not_fail
|
464
|
+
assert_nothing_raised{ @backend.localize 'de', @morning }
|
465
|
+
end
|
466
|
+
|
467
|
+
def test_translate_given_an_unknown_format_it_does_not_fail
|
468
|
+
assert_nothing_raised{ @backend.localize 'de', @morning, '%x' }
|
469
|
+
end
|
470
|
+
end
|
471
|
+
|
472
|
+
class I18nSimpleBackendHelperMethodsTest < Test::Unit::TestCase
|
473
|
+
def setup
|
474
|
+
@backend = I18n::Backend::Simple.new
|
475
|
+
end
|
476
|
+
|
477
|
+
def test_deep_symbolize_keys_works
|
478
|
+
result = @backend.send :deep_symbolize_keys, 'foo' => {'bar' => {'baz' => 'bar'}}
|
479
|
+
expected = {:foo => {:bar => {:baz => 'bar'}}}
|
480
|
+
assert_equal expected, result
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
484
|
+
class I18nSimpleBackendLoadTranslationsTest < Test::Unit::TestCase
|
485
|
+
include I18nSimpleBackendTestSetup
|
486
|
+
|
487
|
+
def test_load_translations_with_unknown_file_type_raises_exception
|
488
|
+
assert_raise(I18n::UnknownFileType) { @backend.load_translations "#{@locale_dir}/en.xml" }
|
489
|
+
end
|
490
|
+
|
491
|
+
def test_load_translations_with_ruby_file_type_does_not_raise_exception
|
492
|
+
assert_nothing_raised { @backend.load_translations "#{@locale_dir}/en.rb" }
|
493
|
+
end
|
494
|
+
|
495
|
+
def test_load_rb_loads_data_from_ruby_file
|
496
|
+
data = @backend.send :load_rb, "#{@locale_dir}/en.rb"
|
497
|
+
assert_equal({:'en-Ruby' => {:foo => {:bar => "baz"}}}, data)
|
498
|
+
end
|
499
|
+
|
500
|
+
def test_load_rb_loads_data_from_yaml_file
|
501
|
+
data = @backend.send :load_yml, "#{@locale_dir}/en.yml"
|
502
|
+
assert_equal({'en-Yaml' => {'foo' => {'bar' => 'baz'}}}, data)
|
503
|
+
end
|
504
|
+
|
505
|
+
def test_load_translations_loads_from_different_file_formats
|
506
|
+
@backend = I18n::Backend::Simple.new
|
507
|
+
@backend.load_translations "#{@locale_dir}/en.rb", "#{@locale_dir}/en.yml"
|
508
|
+
expected = {
|
509
|
+
:'en-Ruby' => {:foo => {:bar => "baz"}},
|
510
|
+
:'en-Yaml' => {:foo => {:bar => "baz"}}
|
511
|
+
}
|
512
|
+
assert_equal expected, backend_get_translations
|
513
|
+
end
|
514
|
+
end
|
515
|
+
|
516
|
+
class I18nSimpleBackendLoadPathTest < Test::Unit::TestCase
|
517
|
+
include I18nSimpleBackendTestSetup
|
518
|
+
|
519
|
+
def teardown
|
520
|
+
I18n.load_path = []
|
521
|
+
end
|
522
|
+
|
523
|
+
def test_nested_load_paths_do_not_break_locale_loading
|
524
|
+
@backend = I18n::Backend::Simple.new
|
525
|
+
I18n.load_path = [[File.dirname(__FILE__) + '/locale/en.yml']]
|
526
|
+
assert_nil backend_get_translations
|
527
|
+
assert_nothing_raised { @backend.send :init_translations }
|
528
|
+
assert_not_nil backend_get_translations
|
529
|
+
end
|
530
|
+
|
531
|
+
def test_adding_arrays_of_filenames_to_load_path_do_not_break_locale_loading
|
532
|
+
@backend = I18n::Backend::Simple.new
|
533
|
+
I18n.load_path << Dir[File.dirname(__FILE__) + '/locale/*.{rb,yml}']
|
534
|
+
assert_nil backend_get_translations
|
535
|
+
assert_nothing_raised { @backend.send :init_translations }
|
536
|
+
assert_not_nil backend_get_translations
|
537
|
+
end
|
538
|
+
end
|
539
|
+
|
540
|
+
class I18nSimpleBackendReloadTranslationsTest < Test::Unit::TestCase
|
541
|
+
include I18nSimpleBackendTestSetup
|
542
|
+
|
543
|
+
def setup
|
544
|
+
@backend = I18n::Backend::Simple.new
|
545
|
+
I18n.load_path = [File.dirname(__FILE__) + '/locale/en.yml']
|
546
|
+
assert_nil backend_get_translations
|
547
|
+
@backend.send :init_translations
|
548
|
+
end
|
549
|
+
|
550
|
+
def teardown
|
551
|
+
I18n.load_path = []
|
552
|
+
end
|
553
|
+
|
554
|
+
def test_setup
|
555
|
+
assert_not_nil backend_get_translations
|
556
|
+
end
|
557
|
+
|
558
|
+
def test_reload_translations_unloads_translations
|
559
|
+
@backend.reload!
|
560
|
+
assert_nil backend_get_translations
|
561
|
+
end
|
562
|
+
|
563
|
+
def test_reload_translations_uninitializes_translations
|
564
|
+
@backend.reload!
|
565
|
+
assert_equal @backend.initialized?, false
|
566
|
+
end
|
567
|
+
end
|