diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-12-07 03:05:03 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-12-07 03:05:03 +0100 |
commit | 8f1c229571b4db8dda144bf6eaa193799309e817 (patch) | |
tree | 592710207a614428d5cb809f6e13c8b546b58969 /activesupport | |
parent | 601e40e744f44fe8819be100a8c472ea161d13ab (diff) | |
parent | 9eca588bdfbb41f6b48477025d1cd8eea4a38296 (diff) | |
download | rails-8f1c229571b4db8dda144bf6eaa193799309e817.tar.gz rails-8f1c229571b4db8dda144bf6eaa193799309e817.tar.bz2 rails-8f1c229571b4db8dda144bf6eaa193799309e817.zip |
Merge commit 'mainstream/master'
Conflicts:
actionmailer/lib/action_mailer/base.rb
actionpack/lib/action_controller/base.rb
actionpack/lib/action_controller/mime_type.rb
railties/doc/guides/html/activerecord_validations_callbacks.html
railties/doc/guides/html/caching_with_rails.html
railties/doc/guides/html/command_line.html
railties/doc/guides/html/configuring.html
railties/doc/guides/html/creating_plugins.html
railties/doc/guides/html/finders.html
railties/doc/guides/html/routing_outside_in.html
railties/doc/guides/source/activerecord_validations_callbacks.txt
railties/doc/guides/source/caching_with_rails.txt
railties/doc/guides/source/command_line.txt
railties/doc/guides/source/creating_plugins/acts_as_yaffle.txt
railties/doc/guides/source/creating_plugins/controllers.txt
railties/doc/guides/source/creating_plugins/core_ext.txt
railties/doc/guides/source/creating_plugins/helpers.txt
railties/doc/guides/source/creating_plugins/index.txt
railties/doc/guides/source/creating_plugins/migration_generator.txt
railties/doc/guides/source/creating_plugins/models.txt
railties/doc/guides/source/creating_plugins/odds_and_ends.txt
railties/doc/guides/source/creating_plugins/routes.txt
railties/doc/guides/source/finders.txt
railties/doc/guides/source/routing_outside_in.txt
railties/doc/guides/source/testing_rails_applications.txt
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/CHANGELOG | 23 | ||||
-rw-r--r-- | activesupport/lib/active_support.rb | 64 | ||||
-rw-r--r-- | activesupport/lib/active_support/backtrace_cleaner.rb | 72 | ||||
-rw-r--r-- | activesupport/lib/active_support/cache.rb | 13 | ||||
-rw-r--r-- | activesupport/lib/active_support/cache/drb_store.rb | 5 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/access.rb | 26 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/conversions.rb | 3 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb | 19 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/enumerable.rb | 9 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/exception.rb | 20 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/file/atomic.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/conversions.rb | 61 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/delegation.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/conversions.rb | 3 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/misc.rb | 18 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/rexml.rb | 51 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/iterators.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/time/calculations.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 15 | ||||
-rw-r--r-- | activesupport/lib/active_support/deprecation.rb | 52 | ||||
-rw-r--r-- | activesupport/lib/active_support/duration.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/inflector.rb | 11 | ||||
-rw-r--r-- | activesupport/lib/active_support/json/encoding.rb | 52 | ||||
-rw-r--r-- | activesupport/lib/active_support/locale/en.yml (renamed from activesupport/lib/active_support/locale/en-US.yml) | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/memoizable.rb | 44 | ||||
-rw-r--r-- | activesupport/lib/active_support/message_encryptor.rb | 70 | ||||
-rw-r--r-- | activesupport/lib/active_support/message_verifier.rb | 46 | ||||
-rw-r--r-- | activesupport/lib/active_support/option_merger.rb | 8 | ||||
-rw-r--r-- | activesupport/lib/active_support/ordered_hash.rb | 8 | ||||
-rw-r--r-- | activesupport/lib/active_support/secure_random.rb | 14 | ||||
-rw-r--r-- | activesupport/lib/active_support/test_case.rb | 49 | ||||
-rw-r--r-- | activesupport/lib/active_support/testing/assertions.rb | 61 | ||||
-rw-r--r-- | activesupport/lib/active_support/testing/declarative.rb | 21 | ||||
-rw-r--r-- | activesupport/lib/active_support/testing/deprecation.rb | 55 | ||||
-rw-r--r-- | activesupport/lib/active_support/testing/setup_and_teardown.rb | 138 | ||||
-rw-r--r-- | activesupport/lib/active_support/time_with_zone.rb | 1 | ||||
-rw-r--r-- | activesupport/lib/active_support/values/time_zone.rb | 1 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor.rb | 13 | ||||
-rwxr-xr-x | activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb | 6 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Argentina/San_Juan.rb | 170 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/data_timezone.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/data_timezone_info.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Algiers.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Algiers.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Cairo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Cairo.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Casablanca.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Casablanca.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Harare.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Harare.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Johannesburg.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Johannesburg.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Monrovia.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Monrovia.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Nairobi.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Nairobi.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/Buenos_Aires.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Argentina/Buenos_Aires.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb | 86 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Bogota.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Bogota.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Caracas.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Caracas.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chicago.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Chicago.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chihuahua.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Chihuahua.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Denver.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Denver.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Godthab.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Godthab.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Guatemala.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Guatemala.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Halifax.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Halifax.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Indiana/Indianapolis.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Indiana/Indianapolis.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Juneau.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Juneau.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/La_Paz.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/La_Paz.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Lima.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Lima.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Los_Angeles.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Los_Angeles.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mazatlan.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Mazatlan.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mexico_City.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Mexico_City.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Monterrey.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Monterrey.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/New_York.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/New_York.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Phoenix.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Phoenix.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Regina.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Regina.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Santiago.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Santiago.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Sao_Paulo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Sao_Paulo.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/St_Johns.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/St_Johns.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Tijuana.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Tijuana.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Almaty.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Almaty.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baghdad.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Baghdad.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baku.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Baku.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Bangkok.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Bangkok.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Chongqing.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Chongqing.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Colombo.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Dhaka.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Dhaka.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Hong_Kong.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Hong_Kong.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Irkutsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Irkutsk.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jakarta.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Jakarta.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jerusalem.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Jerusalem.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kabul.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kabul.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kamchatka.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kamchatka.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Karachi.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Karachi.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Katmandu.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Katmandu.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kolkata.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kolkata.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Krasnoyarsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Krasnoyarsk.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuala_Lumpur.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kuala_Lumpur.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuwait.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kuwait.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Magadan.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Magadan.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Muscat.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Muscat.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Novosibirsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Novosibirsk.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Rangoon.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Rangoon.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Riyadh.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Riyadh.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Seoul.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Seoul.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Shanghai.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Shanghai.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Singapore.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Singapore.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Taipei.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Taipei.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tashkent.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Tashkent.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tbilisi.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Tbilisi.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tehran.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Tehran.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tokyo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Tokyo.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Ulaanbaatar.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Ulaanbaatar.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Urumqi.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Urumqi.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Vladivostok.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Vladivostok.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yakutsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Yakutsk.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yekaterinburg.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Yekaterinburg.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yerevan.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Yerevan.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Azores.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Atlantic/Azores.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Cape_Verde.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Atlantic/Cape_Verde.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/South_Georgia.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Atlantic/South_Georgia.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Adelaide.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Adelaide.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Brisbane.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Brisbane.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Darwin.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Darwin.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Hobart.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Hobart.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Melbourne.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Melbourne.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Perth.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Perth.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Sydney.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Sydney.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Etc/UTC.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Etc/UTC.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Amsterdam.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Amsterdam.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Athens.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Athens.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Belgrade.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Belgrade.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Berlin.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Berlin.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bratislava.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Bratislava.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Brussels.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Brussels.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bucharest.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Bucharest.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Budapest.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Budapest.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Copenhagen.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Copenhagen.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Dublin.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Dublin.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Helsinki.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Helsinki.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Istanbul.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Istanbul.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Kiev.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Kiev.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Lisbon.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Lisbon.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Ljubljana.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Ljubljana.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/London.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/London.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Madrid.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Madrid.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Minsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Minsk.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Moscow.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Moscow.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Paris.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Paris.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Prague.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Prague.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Riga.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Riga.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Rome.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Rome.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sarajevo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Sarajevo.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Skopje.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Skopje.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sofia.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Sofia.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Stockholm.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Stockholm.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Tallinn.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Tallinn.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vienna.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Vienna.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vilnius.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Vilnius.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Warsaw.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Warsaw.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Zagreb.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Zagreb.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Auckland.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Auckland.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Fiji.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Fiji.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Guam.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Guam.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Honolulu.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Honolulu.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Majuro.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Majuro.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Midway.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Midway.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Noumea.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Noumea.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Pago_Pago.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Pago_Pago.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Port_Moresby.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Port_Moresby.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Tongatapu.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Tongatapu.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/info_timezone.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/info_timezone.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/linked_timezone.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/linked_timezone_info.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/offset_rationals.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/offset_rationals.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/ruby_core_support.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/ruby_core_support.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/time_or_datetime.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_definition.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_definition.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_info.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_offset_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_offset_info.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_period.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_period.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_transition_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_transition_info.rb) | 0 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb | 1021 | ||||
-rw-r--r-- | activesupport/lib/active_support/version.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/xml_mini.rb | 111 | ||||
-rw-r--r-- | activesupport/test/abstract_unit.rb | 49 | ||||
-rw-r--r-- | activesupport/test/caching_test.rb | 38 | ||||
-rw-r--r-- | activesupport/test/clean_backtrace_test.rb | 47 | ||||
-rw-r--r-- | activesupport/test/core_ext/array_ext_test.rb | 24 | ||||
-rw-r--r-- | activesupport/test/core_ext/date_ext_test.rb | 68 | ||||
-rw-r--r-- | activesupport/test/core_ext/date_time_ext_test.rb | 112 | ||||
-rw-r--r-- | activesupport/test/core_ext/duration_test.rb | 120 | ||||
-rw-r--r-- | activesupport/test/core_ext/enumerable_test.rb | 11 | ||||
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 11 | ||||
-rw-r--r-- | activesupport/test/core_ext/module/model_naming_test.rb | 8 | ||||
-rw-r--r-- | activesupport/test/core_ext/module_test.rb | 11 | ||||
-rw-r--r-- | activesupport/test/core_ext/object_and_class_ext_test.rb | 32 | ||||
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 4 | ||||
-rw-r--r-- | activesupport/test/core_ext/time_ext_test.rb | 144 | ||||
-rw-r--r-- | activesupport/test/core_ext/time_with_zone_test.rb | 138 | ||||
-rw-r--r-- | activesupport/test/deprecation_test.rb | 26 | ||||
-rw-r--r-- | activesupport/test/i18n_test.rb | 12 | ||||
-rw-r--r-- | activesupport/test/inflector_test.rb | 6 | ||||
-rw-r--r-- | activesupport/test/inflector_test_cases.rb | 15 | ||||
-rw-r--r-- | activesupport/test/json/encoding_test.rb | 18 | ||||
-rw-r--r-- | activesupport/test/memoizable_test.rb | 346 | ||||
-rw-r--r-- | activesupport/test/message_encryptor_test.rb | 46 | ||||
-rw-r--r-- | activesupport/test/message_verifier_test.rb | 25 | ||||
-rw-r--r-- | activesupport/test/multibyte_unicode_database_test.rb | 6 | ||||
-rw-r--r-- | activesupport/test/option_merger_test.rb | 8 | ||||
-rw-r--r-- | activesupport/test/ordered_hash_test.rb | 12 | ||||
-rw-r--r-- | activesupport/test/test_test.rb | 19 | ||||
-rw-r--r-- | activesupport/test/time_zone_test.rb | 80 |
210 files changed, 1685 insertions, 2215 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 3526c2e8fc..d142f21d61 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,5 +1,26 @@ +*2.3.0 [Edge]* + +* Added ActiveSupport::OrderedHash#each_key and ActiveSupport::OrderedHash#each_value #1410 [Christoffer Sawicki] + +* Added ActiveSupport::MessageVerifier and MessageEncryptor to aid users who need to store signed and/or encrypted messages. [Koz] + +* Added ActiveSupport::BacktraceCleaner to cut down on backtrace noise according to filters and silencers [DHH] + +* Added Object#try. ( Taken from http://ozmm.org/posts/try.html ) [Chris Wanstrath] + +* Added Enumerable#none? to check that none of the elements match the block #1408 [Damian Janowski] + +* TimeZone offset tests: use current_period, to ensure TimeZone#utc_offset is up-to-date [Geoff Buesing] + +* Update bundled TZInfo to 0.3.12 [Geoff Buesing] + +* Added lambda merging to OptionMerger (especially useful with named_scope and with_options) #726 [Paweł Kondzior] + + *2.2.1 [RC2] (November 14th, 2008)* +* Increment the version of our altered memcache-client to prevent confusion caused when the 1.5.0 gem is installed. + * Fixed the option merging in Array#to_xml #1126 [Rudolf Gavlas] * Make I18n::Backend::Simple reload its translations in development mode [DHH/Sven Fuchs] @@ -55,7 +76,7 @@ * Added TimeZone #=~, to support matching zones by regex in time_zone_select. #195 [Ernie Miller] -* Added Array#second through Array#tenth as aliases for Array#[1] through Array#[9] [DHH] +* Added Array#second through Array#fifth as aliases for Array#[1] through Array#[4] + Array#forty_two as alias for Array[41] [DHH] * Added test/do declaration style testing to ActiveSupport::TestCase [DHH via Jay Fields] diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb index 202f4ce6ab..7ebb3c48e0 100644 --- a/activesupport/lib/active_support.rb +++ b/activesupport/lib/active_support.rb @@ -21,41 +21,39 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #++ -require 'active_support/vendor' -require 'active_support/basic_object' -require 'active_support/inflector' -require 'active_support/callbacks' +module ActiveSupport + def self.load_all! + [Dependencies, Deprecation, Gzip, MessageVerifier, Multibyte, SecureRandom, TimeWithZone] + end + + autoload :BacktraceCleaner, 'active_support/backtrace_cleaner' + autoload :Base64, 'active_support/base64' + autoload :BasicObject, 'active_support/basic_object' + autoload :BufferedLogger, 'active_support/buffered_logger' + autoload :Cache, 'active_support/cache' + autoload :Callbacks, 'active_support/callbacks' + autoload :Deprecation, 'active_support/deprecation' + autoload :Duration, 'active_support/duration' + autoload :Gzip, 'active_support/gzip' + autoload :Inflector, 'active_support/inflector' + autoload :Memoizable, 'active_support/memoizable' + autoload :MessageEncryptor, 'active_support/message_encryptor' + autoload :MessageVerifier, 'active_support/message_verifier' + autoload :Multibyte, 'active_support/multibyte' + autoload :OptionMerger, 'active_support/option_merger' + autoload :OrderedHash, 'active_support/ordered_hash' + autoload :OrderedOptions, 'active_support/ordered_options' + autoload :Rescuable, 'active_support/rescuable' + autoload :SecureRandom, 'active_support/secure_random' + autoload :StringInquirer, 'active_support/string_inquirer' + autoload :TimeWithZone, 'active_support/time_with_zone' + autoload :TimeZone, 'active_support/values/time_zone' + autoload :XmlMini, 'active_support/xml_mini' +end +require 'active_support/vendor' require 'active_support/core_ext' - -require 'active_support/buffered_logger' - -require 'active_support/gzip' -require 'active_support/cache' - require 'active_support/dependencies' -require 'active_support/deprecation' - -require 'active_support/ordered_hash' -require 'active_support/ordered_options' -require 'active_support/option_merger' - -require 'active_support/memoizable' -require 'active_support/string_inquirer' - -require 'active_support/values/time_zone' -require 'active_support/duration' - require 'active_support/json' -require 'active_support/multibyte' - -require 'active_support/base64' - -require 'active_support/time_with_zone' - -require 'active_support/secure_random' - -require 'active_support/rescuable' - -I18n.load_path << File.dirname(__FILE__) + '/active_support/locale/en-US.yml' +I18n.load_path << "#{File.dirname(__FILE__)}/active_support/locale/en.yml" diff --git a/activesupport/lib/active_support/backtrace_cleaner.rb b/activesupport/lib/active_support/backtrace_cleaner.rb new file mode 100644 index 0000000000..0e262c003e --- /dev/null +++ b/activesupport/lib/active_support/backtrace_cleaner.rb @@ -0,0 +1,72 @@ +module ActiveSupport + # Many backtraces include too much information that's not relevant for the context. This makes it hard to find the signal + # in the backtrace and adds debugging time. With a BacktraceCleaner, you can setup filters and silencers for your particular + # context, so only the relevant lines are included. + # + # If you need to reconfigure an existing BacktraceCleaner, like the one in Rails, to show as much as possible, you can always + # call BacktraceCleaner#remove_silencers! + # + # Example: + # + # bc = BacktraceCleaner.new + # bc.add_filter { |line| line.gsub(Rails.root, '') } + # bc.add_silencer { |line| line =~ /mongrel|rubygems/ } + # bc.clean(exception.backtrace) # will strip the Rails.root prefix and skip any lines from mongrel or rubygems + # + # Inspired by the Quiet Backtrace gem by Thoughtbot. + class BacktraceCleaner + def initialize + @filters, @silencers = [], [] + end + + # Returns the backtrace after all filters and silencers has been run against it. Filters run first, then silencers. + def clean(backtrace) + silence(filter(backtrace)) + end + + # Adds a filter from the block provided. Each line in the backtrace will be mapped against this filter. + # + # Example: + # + # # Will turn "/my/rails/root/app/models/person.rb" into "/app/models/person.rb" + # backtrace_cleaner.add_filter { |line| line.gsub(Rails.root, '') } + def add_filter(&block) + @filters << block + end + + # Adds a silencer from the block provided. If the silencer returns true for a given line, it'll be excluded from the + # clean backtrace. + # + # Example: + # + # # Will reject all lines that include the word "mongrel", like "/gems/mongrel/server.rb" or "/app/my_mongrel_server/rb" + # backtrace_cleaner.add_silencer { |line| line =~ /mongrel/ } + def add_silencer(&block) + @silencers << block + end + + # Will remove all silencers, but leave in the filters. This is useful if your context of debugging suddenly expands as + # you suspect a bug in the libraries you use. + def remove_silencers! + @silencers = [] + end + + + private + def filter(backtrace) + @filters.each do |f| + backtrace = backtrace.map { |line| f.call(line) } + end + + backtrace + end + + def silence(backtrace) + @silencers.each do |s| + backtrace = backtrace.reject { |line| s.call(line) } + end + + backtrace + end + end +end diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index e62cec6fcb..10281d60eb 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -3,6 +3,13 @@ require 'benchmark' module ActiveSupport # See ActiveSupport::Cache::Store for documentation. module Cache + autoload :FileStore, 'active_support/cache/file_store' + autoload :MemoryStore, 'active_support/cache/memory_store' + autoload :SynchronizedMemoryStore, 'active_support/cache/synchronized_memory_store' + autoload :DRbStore, 'active_support/cache/drb_store' + autoload :MemCacheStore, 'active_support/cache/mem_cache_store' + autoload :CompressedMemCacheStore, 'active_support/cache/compressed_mem_cache_store' + # Creates a new CacheStore object according to the given options. # # If no arguments are passed to this method, then a new @@ -215,9 +222,3 @@ module ActiveSupport end end end - -require 'active_support/cache/file_store' -require 'active_support/cache/memory_store' -require 'active_support/cache/drb_store' -require 'active_support/cache/mem_cache_store' -require 'active_support/cache/compressed_mem_cache_store' diff --git a/activesupport/lib/active_support/cache/drb_store.rb b/activesupport/lib/active_support/cache/drb_store.rb index b80c2ee4d5..b16ed25aa3 100644 --- a/activesupport/lib/active_support/cache/drb_store.rb +++ b/activesupport/lib/active_support/cache/drb_store.rb @@ -1,15 +1,14 @@ -require 'drb' - module ActiveSupport module Cache class DRbStore < MemoryStore #:nodoc: attr_reader :address def initialize(address = 'druby://localhost:9192') + require 'drb' unless defined?(DRbObject) super() @address = address @data = DRbObject.new(nil, address) end end end -end
\ No newline at end of file +end diff --git a/activesupport/lib/active_support/core_ext.rb b/activesupport/lib/active_support/core_ext.rb index 4deef8c7a5..f2f976df9b 100644 --- a/activesupport/lib/active_support/core_ext.rb +++ b/activesupport/lib/active_support/core_ext.rb @@ -1,4 +1,4 @@ Dir[File.dirname(__FILE__) + "/core_ext/*.rb"].sort.each do |path| - filename = File.basename(path) + filename = File.basename(path, '.rb') require "active_support/core_ext/#{filename}" end diff --git a/activesupport/lib/active_support/core_ext/array/access.rb b/activesupport/lib/active_support/core_ext/array/access.rb index a3b2a54c7d..6de338bfcc 100644 --- a/activesupport/lib/active_support/core_ext/array/access.rb +++ b/activesupport/lib/active_support/core_ext/array/access.rb @@ -43,29 +43,9 @@ module ActiveSupport #:nodoc: self[4] end - # Equal to <tt>self[5]</tt>. - def sixth - self[5] - end - - # Equal to <tt>self[6]</tt>. - def seventh - self[6] - end - - # Equal to <tt>self[7]</tt>. - def eighth - self[7] - end - - # Equal to <tt>self[8]</tt>. - def ninth - self[8] - end - - # Equal to <tt>self[9]</tt>. - def tenth - self[9] + # Equal to <tt>self[41]</tt>. Also known as accessing "the reddit". + def forty_two + self[41] end end end diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb index cf3e03f62c..f0d6591135 100644 --- a/activesupport/lib/active_support/core_ext/array/conversions.rb +++ b/activesupport/lib/active_support/core_ext/array/conversions.rb @@ -1,5 +1,3 @@ -require 'builder' - module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module Array #:nodoc: @@ -149,6 +147,7 @@ module ActiveSupport #:nodoc: # def to_xml(options = {}) raise "Not all elements respond to to_xml" unless all? { |e| e.respond_to? :to_xml } + require 'builder' unless defined?(Builder) options[:root] ||= all? { |e| e.is_a?(first.class) && first.class.to_s != "Hash" } ? first.class.to_s.underscore.pluralize : "records" options[:children] ||= options[:root].singularize diff --git a/activesupport/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb b/activesupport/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb index a21e98fa80..1edb3771a2 100644 --- a/activesupport/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +++ b/activesupport/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb @@ -2,11 +2,20 @@ module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module CGI #:nodoc: module EscapeSkippingSlashes #:nodoc: - def escape_skipping_slashes(str) - str = str.join('/') if str.respond_to? :join - str.gsub(/([^ \/a-zA-Z0-9_.-])/n) do - "%#{$1.unpack('H2').first.upcase}" - end.tr(' ', '+') + if RUBY_VERSION >= '1.9' + def escape_skipping_slashes(str) + str = str.join('/') if str.respond_to? :join + str.gsub(/([^ \/a-zA-Z0-9_.-])/n) do + "%#{$1.unpack('H2' * $1.bytesize).join('%').upcase}" + end.tr(' ', '+') + end + else + def escape_skipping_slashes(str) + str = str.join('/') if str.respond_to? :join + str.gsub(/([^ \/a-zA-Z0-9_.-])/n) do + "%#{$1.unpack('H2').first.upcase}" + end.tr(' ', '+') + end end end end diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb index 788f3a7e9e..a7eaccfed7 100644 --- a/activesupport/lib/active_support/core_ext/enumerable.rb +++ b/activesupport/lib/active_support/core_ext/enumerable.rb @@ -104,4 +104,13 @@ module Enumerable size = block_given? ? select(&block).size : self.size size > 1 end + + # Returns true if none of the elements match the given block. + # + # success = responses.none? {|r| r.status / 100 == 5 } + # + # This is a builtin method in Ruby 1.8.7 and later. + def none?(&block) + !any?(&block) + end unless [].respond_to?(:none?) end diff --git a/activesupport/lib/active_support/core_ext/exception.rb b/activesupport/lib/active_support/core_ext/exception.rb index 57c8568334..cde0df4153 100644 --- a/activesupport/lib/active_support/core_ext/exception.rb +++ b/activesupport/lib/active_support/core_ext/exception.rb @@ -6,14 +6,16 @@ module ActiveSupport end end +# TODO: Turn all this into using the BacktraceCleaner. class Exception # :nodoc: def clean_message Pathname.clean_within message end - + TraceSubstitutions = [] - FrameworkRegexp = /generated|vendor|dispatch|ruby|script\/\w+/ - + FrameworkStart = /action_controller\/dispatcher\.rb/.freeze + FrameworkRegexp = /generated|vendor|dispatch|ruby|script\/\w+/.freeze + def clean_backtrace backtrace.collect do |line| Pathname.clean_within(TraceSubstitutions.inject(line) do |result, (regexp, sub)| @@ -21,20 +23,22 @@ class Exception # :nodoc: end) end end - + def application_backtrace + before_framework_frame = nil before_application_frame = true - + trace = clean_backtrace.reject do |line| + before_framework_frame ||= (line =~ FrameworkStart) non_app_frame = (line =~ FrameworkRegexp) before_application_frame = false unless non_app_frame - non_app_frame && ! before_application_frame + before_framework_frame || (non_app_frame && !before_application_frame) end - + # If we didn't find any application frames, return an empty app trace. before_application_frame ? [] : trace end - + def framework_backtrace clean_backtrace.grep FrameworkRegexp end diff --git a/activesupport/lib/active_support/core_ext/file/atomic.rb b/activesupport/lib/active_support/core_ext/file/atomic.rb index f988eff3d9..976d462e8e 100644 --- a/activesupport/lib/active_support/core_ext/file/atomic.rb +++ b/activesupport/lib/active_support/core_ext/file/atomic.rb @@ -1,5 +1,3 @@ -require 'tempfile' - module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module File #:nodoc: @@ -18,6 +16,8 @@ module ActiveSupport #:nodoc: # file.write("hello") # end def atomic_write(file_name, temp_dir = Dir.tmpdir) + require 'tempfile' unless defined?(Tempfile) + temp_file = Tempfile.new(basename(file_name), temp_dir) yield temp_file temp_file.close diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb index 50dc7c61fc..437b44c51c 100644 --- a/activesupport/lib/active_support/core_ext/hash/conversions.rb +++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb @@ -1,47 +1,22 @@ require 'date' -require 'cgi' -require 'builder' -require 'xmlsimple' - -# Locked down XmlSimple#xml_in_string -class XmlSimple - # Same as xml_in but doesn't try to smartly shoot itself in the foot. - def xml_in_string(string, options = nil) - handle_options('in', options) - - @doc = parse(string) - result = collapse(@doc.root) - - if @options['keeproot'] - merge({}, @doc.root.name, result) - else - result - end - end - - def self.xml_in_string(string, options = nil) - new.xml_in_string(string, options) - end -end - -# This module exists to decorate files deserialized using Hash.from_xml with -# the <tt>original_filename</tt> and <tt>content_type</tt> methods. -module FileLike #:nodoc: - attr_writer :original_filename, :content_type - - def original_filename - @original_filename || 'untitled' - end - - def content_type - @content_type || 'application/octet-stream' - end -end module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module Hash #:nodoc: module Conversions + # This module exists to decorate files deserialized using Hash.from_xml with + # the <tt>original_filename</tt> and <tt>content_type</tt> methods. + module FileLike #:nodoc: + attr_writer :original_filename, :content_type + + def original_filename + @original_filename || 'untitled' + end + + def content_type + @content_type || 'application/octet-stream' + end + end XML_TYPE_NAMES = { "Symbol" => "symbol", @@ -113,6 +88,8 @@ module ActiveSupport #:nodoc: alias_method :to_param, :to_query def to_xml(options = {}) + require 'builder' unless defined?(Builder) + options[:indent] ||= 2 options.reverse_merge!({ :builder => Builder::XmlMarkup.new(:indent => options[:indent]), :root => "hash" }) @@ -167,13 +144,7 @@ module ActiveSupport #:nodoc: module ClassMethods def from_xml(xml) - # TODO: Refactor this into something much cleaner that doesn't rely on XmlSimple - typecast_xml_value(undasherize_keys(XmlSimple.xml_in_string(xml, - 'forcearray' => false, - 'forcecontent' => true, - 'keeproot' => true, - 'contentkey' => '__content__') - )) + typecast_xml_value(undasherize_keys(XmlMini.parse(xml))) end private diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb index 1ad18402e5..2905eebc85 100644 --- a/activesupport/lib/active_support/core_ext/module/delegation.rb +++ b/activesupport/lib/active_support/core_ext/module/delegation.rb @@ -78,6 +78,10 @@ class Module raise ArgumentError, "Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter)." end + if options[:prefix] == true && options[:to].to_s =~ /^[^a-z_]/ + raise ArgumentError, "Can only automatically set the delegation prefix when delegating to a method." + end + prefix = options[:prefix] && "#{options[:prefix] == true ? to : options[:prefix]}_" methods.each do |method| diff --git a/activesupport/lib/active_support/core_ext/object/conversions.rb b/activesupport/lib/active_support/core_ext/object/conversions.rb index ad752f0fc5..278b856c45 100644 --- a/activesupport/lib/active_support/core_ext/object/conversions.rb +++ b/activesupport/lib/active_support/core_ext/object/conversions.rb @@ -9,6 +9,7 @@ class Object # # Note: This method is defined as a default implementation for all Objects for Hash#to_query to work. def to_query(key) + require 'cgi' unless defined?(CGI) && defined?(CGI::escape) "#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}" end -end
\ No newline at end of file +end diff --git a/activesupport/lib/active_support/core_ext/object/misc.rb b/activesupport/lib/active_support/core_ext/object/misc.rb index cd0a04d32a..46f9c7d676 100644 --- a/activesupport/lib/active_support/core_ext/object/misc.rb +++ b/activesupport/lib/active_support/core_ext/object/misc.rb @@ -71,4 +71,22 @@ class Object def acts_like?(duck) respond_to? "acts_like_#{duck}?" end + + # Tries to send the method only if object responds to it. Return +nil+ otherwise. + # It will also forward any arguments and/or block like Object#send does. + # + # ==== Example : + # + # # Without try + # @person ? @person.name : nil + # + # With try + # @person.try(:name) + # + # # try also accepts arguments/blocks for the method it is trying + # Person.try(:find, 1) + # @people.try(:map) {|p| p.name} + def try(method, *args, &block) + send(method, *args, &block) if respond_to?(method, true) + end end diff --git a/activesupport/lib/active_support/core_ext/rexml.rb b/activesupport/lib/active_support/core_ext/rexml.rb index 187f3e0f5e..b4891a9153 100644 --- a/activesupport/lib/active_support/core_ext/rexml.rb +++ b/activesupport/lib/active_support/core_ext/rexml.rb @@ -1,34 +1,39 @@ -require 'rexml/document' -require 'rexml/entity' - # Fixes the rexml vulnerability disclosed at: # http://www.ruby-lang.org/en/news/2008/08/23/dos-vulnerability-in-rexml/ # This fix is identical to rexml-expansion-fix version 1.0.1 +require 'rexml/rexml' # Earlier versions of rexml defined REXML::Version, newer ones REXML::VERSION unless (defined?(REXML::VERSION) ? REXML::VERSION : REXML::Version) > "3.1.7.2" - module REXML - class Entity < Child - undef_method :unnormalized - def unnormalized - document.record_entity_expansion! if document - v = value() - return nil if v.nil? - @unnormalized = Text::unnormalize(v, parent) - @unnormalized - end - end - class Document < Element - @@entity_expansion_limit = 10_000 - def self.entity_expansion_limit= val - @@entity_expansion_limit = val + require 'rexml/document' + + # REXML in 1.8.7 has the patch but didn't update Version from 3.1.7.2. + unless REXML::Document.respond_to?(:entity_expansion_limit=) + require 'rexml/entity' + + module REXML + class Entity < Child + undef_method :unnormalized + def unnormalized + document.record_entity_expansion! if document + v = value() + return nil if v.nil? + @unnormalized = Text::unnormalize(v, parent) + @unnormalized + end end + class Document < Element + @@entity_expansion_limit = 10_000 + def self.entity_expansion_limit= val + @@entity_expansion_limit = val + end - def record_entity_expansion! - @number_of_expansions ||= 0 - @number_of_expansions += 1 - if @number_of_expansions > @@entity_expansion_limit - raise "Number of entity expansions exceeded, processing aborted." + def record_entity_expansion! + @number_of_expansions ||= 0 + @number_of_expansions += 1 + if @number_of_expansions > @@entity_expansion_limit + raise "Number of entity expansions exceeded, processing aborted." + end end end end diff --git a/activesupport/lib/active_support/core_ext/string/iterators.rb b/activesupport/lib/active_support/core_ext/string/iterators.rb index 66a08a5cd0..fe17d140ca 100644 --- a/activesupport/lib/active_support/core_ext/string/iterators.rb +++ b/activesupport/lib/active_support/core_ext/string/iterators.rb @@ -13,7 +13,9 @@ module ActiveSupport #:nodoc: # When $KCODE = 'UTF8', multi-byte characters are yielded appropriately. def each_char scanner, char = StringScanner.new(self), /./mu - loop { yield(scanner.scan(char) || break) } + while c = scanner.scan(char) + yield c + end end end end diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index 00078de692..5ed750afcc 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -1,3 +1,5 @@ +require 'active_support/duration' + module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module Time #:nodoc: diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index fe568d6127..293450c180 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -313,12 +313,13 @@ module ActiveSupport #:nodoc: nesting = expanded_path[(expanded_root.size)..-1] nesting = nesting[1..-1] if nesting && nesting[0] == ?/ next if nesting.blank? - - [ - nesting.camelize, - # Special case: application.rb might define ApplicationControlller. - ('ApplicationController' if nesting == 'application') - ] + nesting_camel = nesting.camelize + begin + qualified_const_defined?(nesting_camel) + rescue NameError + next + end + [ nesting_camel ] end.flatten.compact.uniq end @@ -499,7 +500,7 @@ module ActiveSupport #:nodoc: initial_constants = if qualified_const_defined?(mod_name) mod_name.constantize.local_constant_names else - [] + [] end else raise Argument, "#{desc.inspect} does not describe a module!" diff --git a/activesupport/lib/active_support/deprecation.rb b/activesupport/lib/active_support/deprecation.rb index b4d8f61b8c..543e3b08d2 100644 --- a/activesupport/lib/active_support/deprecation.rb +++ b/activesupport/lib/active_support/deprecation.rb @@ -113,37 +113,6 @@ module ActiveSupport end end - module Assertions #:nodoc: - def assert_deprecated(match = nil, &block) - result, warnings = collect_deprecations(&block) - assert !warnings.empty?, "Expected a deprecation warning within the block but received none" - if match - match = Regexp.new(Regexp.escape(match)) unless match.is_a?(Regexp) - assert warnings.any? { |w| w =~ match }, "No deprecation warning matched #{match}: #{warnings.join(', ')}" - end - result - end - - def assert_not_deprecated(&block) - result, deprecations = collect_deprecations(&block) - assert deprecations.empty?, "Expected no deprecation warning within the block but received #{deprecations.size}: \n #{deprecations * "\n "}" - result - end - - private - def collect_deprecations - old_behavior = ActiveSupport::Deprecation.behavior - deprecations = [] - ActiveSupport::Deprecation.behavior = Proc.new do |message, callstack| - deprecations << message - end - result = yield - [result, deprecations] - ensure - ActiveSupport::Deprecation.behavior = old_behavior - end - end - class DeprecationProxy #:nodoc: silence_warnings do instance_methods.each { |m| undef_method m unless m =~ /^__/ } @@ -220,24 +189,3 @@ end class Module include ActiveSupport::Deprecation::ClassMethods end - -require 'test/unit/error' - -module Test - module Unit - class TestCase - include ActiveSupport::Deprecation::Assertions - end - - class Error # :nodoc: - # Silence warnings when reporting test errors. - def message_with_silenced_deprecation - ActiveSupport::Deprecation.silence do - message_without_silenced_deprecation - end - end - - alias_method_chain :message, :silenced_deprecation - end - end -end diff --git a/activesupport/lib/active_support/duration.rb b/activesupport/lib/active_support/duration.rb index 8eae85d38e..c41e86dfd1 100644 --- a/activesupport/lib/active_support/duration.rb +++ b/activesupport/lib/active_support/duration.rb @@ -1,3 +1,5 @@ +require 'active_support/basic_object' + module ActiveSupport # Provides accurate date and time measurements using Date#advance and # Time#advance, respectively. It mainly supports the methods on Numeric, diff --git a/activesupport/lib/active_support/inflector.rb b/activesupport/lib/active_support/inflector.rb index 5cb665ef75..4921b99677 100644 --- a/activesupport/lib/active_support/inflector.rb +++ b/activesupport/lib/active_support/inflector.rb @@ -134,7 +134,6 @@ module ActiveSupport # "octopus".pluralize # => "octopi" # "sheep".pluralize # => "sheep" # "words".pluralize # => "words" - # "the blue mailman".pluralize # => "the blue mailmen" # "CamelOctopus".pluralize # => "CamelOctopi" def pluralize(word) result = word.to_s.dup @@ -154,7 +153,6 @@ module ActiveSupport # "octopi".singularize # => "octopus" # "sheep".singluarize # => "sheep" # "word".singularize # => "word" - # "the blue mailmen".singularize # => "the blue mailman" # "CamelOctopi".singularize # => "CamelOctopus" def singularize(word) result = word.to_s.dup @@ -277,9 +275,16 @@ module ActiveSupport Iconv.iconv('ascii//ignore//translit', 'utf-8', string).to_s end + if RUBY_VERSION >= '1.9' + undef_method :transliterate + def transliterate(string) + warn "Ruby 1.9 doesn't support Unicode normalization yet" + string.dup + end + # The iconv transliteration code doesn't function correctly # on some platforms, but it's very fast where it does function. - if "foo" != Inflector.transliterate("föö") + elsif "foo" != Inflector.transliterate("föö") undef_method :transliterate def transliterate(string) string.mb_chars.normalize(:kd). # Decompose accented characters diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb index 8650e34228..aaaa3cdfd2 100644 --- a/activesupport/lib/active_support/json/encoding.rb +++ b/activesupport/lib/active_support/json/encoding.rb @@ -1,37 +1,31 @@ -require 'active_support/json/variable' -require 'active_support/json/encoders/object' # Require explicitly for rdoc. -Dir["#{File.dirname(__FILE__)}/encoders/**/*.rb"].each do |file| - basename = File.basename(file, '.rb') - unless basename == 'object' - require "active_support/json/encoders/#{basename}" - end -end - module ActiveSupport module JSON class CircularReferenceError < StandardError end - class << self - REFERENCE_STACK_VARIABLE = :json_reference_stack #:nodoc: - - # Converts a Ruby object into a JSON string. - def encode(value, options = {}) - raise_on_circular_reference(value) do - value.send(:to_json, options) - end - end - - protected - def raise_on_circular_reference(value) #:nodoc: - stack = Thread.current[REFERENCE_STACK_VARIABLE] ||= [] - raise CircularReferenceError, 'object references itself' if - stack.include? value - stack << value - yield - ensure - stack.pop - end + # Converts a Ruby object into a JSON string. + def self.encode(value, options = {}) + seen = (options[:seen] ||= []) + raise CircularReferenceError, 'object references itself' if seen.include?(value) + seen << value + value.send(:to_json, options) + ensure + seen.pop end end end + +require 'active_support/json/variable' +require 'active_support/json/encoders/date' +require 'active_support/json/encoders/date_time' +require 'active_support/json/encoders/enumerable' +require 'active_support/json/encoders/false_class' +require 'active_support/json/encoders/hash' +require 'active_support/json/encoders/nil_class' +require 'active_support/json/encoders/numeric' +require 'active_support/json/encoders/object' +require 'active_support/json/encoders/regexp' +require 'active_support/json/encoders/string' +require 'active_support/json/encoders/symbol' +require 'active_support/json/encoders/time' +require 'active_support/json/encoders/true_class' diff --git a/activesupport/lib/active_support/locale/en-US.yml b/activesupport/lib/active_support/locale/en.yml index c31694b9d6..92132cacd5 100644 --- a/activesupport/lib/active_support/locale/en-US.yml +++ b/activesupport/lib/active_support/locale/en.yml @@ -1,4 +1,4 @@ -en-US: +en: date: formats: # Use the strftime parameters for formats. diff --git a/activesupport/lib/active_support/memoizable.rb b/activesupport/lib/active_support/memoizable.rb index cd5c01cda2..9f2fd3a401 100644 --- a/activesupport/lib/active_support/memoizable.rb +++ b/activesupport/lib/active_support/memoizable.rb @@ -1,10 +1,10 @@ module ActiveSupport module Memoizable - MEMOIZED_IVAR = Proc.new do |symbol| + def self.memoized_ivar_for(symbol) "@_memoized_#{symbol.to_s.sub(/\?\Z/, '_query').sub(/!\Z/, '_bang')}".to_sym end - module Freezable + module InstanceMethods def self.included(base) base.class_eval do unless base.method_defined?(:freeze_without_memoizable) @@ -19,23 +19,35 @@ module ActiveSupport end def memoize_all - methods.each do |m| - if m.to_s =~ /^_unmemoized_(.*)/ - if method(m).arity == 0 - __send__($1) - else - ivar = MEMOIZED_IVAR.call($1) - instance_variable_set(ivar, {}) + prime_cache ".*" + end + + def unmemoize_all + flush_cache ".*" + end + + def prime_cache(*syms) + syms.each do |sym| + methods.each do |m| + if m.to_s =~ /^_unmemoized_(#{sym})/ + if method(m).arity == 0 + __send__($1) + else + ivar = ActiveSupport::Memoizable.memoized_ivar_for($1) + instance_variable_set(ivar, {}) + end end end end end - def unmemoize_all - methods.each do |m| - if m.to_s =~ /^_unmemoized_(.*)/ - ivar = MEMOIZED_IVAR.call($1) - instance_variable_get(ivar).clear if instance_variable_defined?(ivar) + def flush_cache(*syms, &block) + syms.each do |sym| + methods.each do |m| + if m.to_s =~ /^_unmemoized_(#{sym})/ + ivar = ActiveSupport::Memoizable.memoized_ivar_for($1) + instance_variable_get(ivar).clear if instance_variable_defined?(ivar) + end end end end @@ -44,10 +56,10 @@ module ActiveSupport def memoize(*symbols) symbols.each do |symbol| original_method = :"_unmemoized_#{symbol}" - memoized_ivar = MEMOIZED_IVAR.call(symbol) + memoized_ivar = ActiveSupport::Memoizable.memoized_ivar_for(symbol) class_eval <<-EOS, __FILE__, __LINE__ - include Freezable + include InstanceMethods raise "Already memoized #{symbol}" if method_defined?(:#{original_method}) alias #{original_method} #{symbol} diff --git a/activesupport/lib/active_support/message_encryptor.rb b/activesupport/lib/active_support/message_encryptor.rb new file mode 100644 index 0000000000..347af9dc76 --- /dev/null +++ b/activesupport/lib/active_support/message_encryptor.rb @@ -0,0 +1,70 @@ +require 'openssl' + +module ActiveSupport + # MessageEncryptor is a simple way to encrypt values which get stored somewhere + # you don't trust. + # + # The cipher text and initialization vector are base64 encoded and returned to you. + # + # This can be used in situations similar to the MessageVerifier, but where you don't + # want users to be able to determine the value of the payload. + class MessageEncryptor + class InvalidMessage < StandardError; end + OpenSSLCipherError = OpenSSL::Cipher.const_defined?(:CipherError) ? OpenSSL::Cipher::CipherError : OpenSSL::CipherError + + def initialize(secret, cipher = 'aes-256-cbc') + @secret = secret + @cipher = cipher + end + + def encrypt(value) + cipher = new_cipher + # Rely on OpenSSL for the initialization vector + iv = cipher.random_iv + + cipher.encrypt + cipher.key = @secret + cipher.iv = iv + + encrypted_data = cipher.update(Marshal.dump(value)) + encrypted_data << cipher.final + + [encrypted_data, iv].map {|v| ActiveSupport::Base64.encode64s(v)}.join("--") + end + + def decrypt(encrypted_message) + cipher = new_cipher + encrypted_data, iv = encrypted_message.split("--").map {|v| ActiveSupport::Base64.decode64(v)} + + cipher.decrypt + cipher.key = @secret + cipher.iv = iv + + decrypted_data = cipher.update(encrypted_data) + decrypted_data << cipher.final + + Marshal.load(decrypted_data) + rescue OpenSSLCipherError, TypeError + raise InvalidMessage + end + + def encrypt_and_sign(value) + verifier.generate(encrypt(value)) + end + + def decrypt_and_verify(value) + decrypt(verifier.verify(value)) + end + + + + private + def new_cipher + OpenSSL::Cipher::Cipher.new(@cipher) + end + + def verifier + MessageVerifier.new(@secret) + end + end +end diff --git a/activesupport/lib/active_support/message_verifier.rb b/activesupport/lib/active_support/message_verifier.rb new file mode 100644 index 0000000000..b24acb9f47 --- /dev/null +++ b/activesupport/lib/active_support/message_verifier.rb @@ -0,0 +1,46 @@ +module ActiveSupport + # MessageVerifier makes it easy to generate and verify messages which are signed + # to prevent tampering. + # + # This is useful for cases like remember-me tokens and auto-unsubscribe links where the + # session store isn't suitable or available. + # + # Remember Me: + # cookies[:remember_me] = @verifier.generate([@user.id, 2.weeks.from_now]) + # + # In the authentication filter: + # + # id, time = @verifier.verify(cookies[:remember_me]) + # if time < Time.now + # self.current_user = User.find(id) + # end + # + class MessageVerifier + class InvalidSignature < StandardError; end + + def initialize(secret, digest = 'SHA1') + @secret = secret + @digest = digest + end + + def verify(signed_message) + data, digest = signed_message.split("--") + if digest != generate_digest(data) + raise InvalidSignature + else + Marshal.load(ActiveSupport::Base64.decode64(data)) + end + end + + def generate(value) + data = ActiveSupport::Base64.encode64s(Marshal.dump(value)) + "#{data}--#{generate_digest(data)}" + end + + private + def generate_digest(data) + require 'openssl' unless defined?(OpenSSL) + OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new(@digest), @secret, data) + end + end +end diff --git a/activesupport/lib/active_support/option_merger.rb b/activesupport/lib/active_support/option_merger.rb index b563b093ed..63662b75c7 100644 --- a/activesupport/lib/active_support/option_merger.rb +++ b/activesupport/lib/active_support/option_merger.rb @@ -10,7 +10,13 @@ module ActiveSupport private def method_missing(method, *arguments, &block) - arguments << (arguments.last.respond_to?(:to_hash) ? @options.deep_merge(arguments.pop) : @options.dup) + if arguments.last.is_a?(Proc) + proc = arguments.pop + arguments << lambda { |*args| @options.deep_merge(proc.call(*args)) } + else + arguments << (arguments.last.respond_to?(:to_hash) ? @options.deep_merge(arguments.pop) : @options.dup) + end + @context.__send__(method, *arguments, &block) end end diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb index 9757054e43..5de94c67e0 100644 --- a/activesupport/lib/active_support/ordered_hash.rb +++ b/activesupport/lib/active_support/ordered_hash.rb @@ -53,6 +53,14 @@ module ActiveSupport end alias_method :value?, :has_value? + + def each_key + each { |key, value| yield key } + end + + def each_value + each { |key, value| yield value } + end end end end diff --git a/activesupport/lib/active_support/secure_random.rb b/activesupport/lib/active_support/secure_random.rb index 97971e8830..cfbce4d754 100644 --- a/activesupport/lib/active_support/secure_random.rb +++ b/activesupport/lib/active_support/secure_random.rb @@ -1,16 +1,11 @@ begin - require 'openssl' -rescue LoadError -end - -begin require 'securerandom' rescue LoadError end module ActiveSupport if defined?(::SecureRandom) - # Use Ruby 1.9's SecureRandom library whenever possible. + # Use Ruby's SecureRandom library if available. SecureRandom = ::SecureRandom # :nodoc: else # = Secure random number generator interface. @@ -64,6 +59,13 @@ module ActiveSupport def self.random_bytes(n=nil) n ||= 16 + unless defined? OpenSSL + begin + require 'openssl' + rescue LoadError + end + end + if defined? OpenSSL::Random return OpenSSL::Random.random_bytes(n) end diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index 197e73b3e8..97b2b6ef9c 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -1,24 +1,39 @@ -require 'test/unit/testcase' -require 'active_support/testing/default' -require 'active_support/testing/core_ext/test' +begin + gem 'mocha', '>= 0.9.3' + require 'mocha' +rescue LoadError + # Fake Mocha::ExpectationError so we can rescue it in #run. Bleh. + Object.const_set :Mocha, Module.new + Mocha.const_set :ExpectationError, Class.new(StandardError) +end +require 'test/unit/testcase' +require 'active_support/testing/setup_and_teardown' +require 'active_support/testing/assertions' +require 'active_support/testing/deprecation' +require 'active_support/testing/declarative' module ActiveSupport - class TestCase < Test::Unit::TestCase - # test "verify something" do - # ... - # end - def self.test(name, &block) - test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym - defined = instance_method(test_name) rescue false - raise "#{test_name} is already defined in #{self}" if defined - if block_given? - define_method(test_name, &block) - else - define_method(test_name) do - flunk "No implementation provided for #{name}" - end + class TestCase < ::Test::Unit::TestCase + if defined? MiniTest + Assertion = MiniTest::Assertion + alias_method :method_name, :name + else + # TODO: Figure out how to get the Rails::BacktraceFilter into minitest/unit + if defined?(Rails) + require 'rails/backtrace_cleaner' + Test::Unit::Util::BacktraceFilter.module_eval { include Rails::BacktraceFilterForTestUnit } end + + Assertion = Test::Unit::AssertionFailedError + + require 'active_support/testing/default' + include ActiveSupport::Testing::Default end + + include ActiveSupport::Testing::SetupAndTeardown + include ActiveSupport::Testing::Assertions + include ActiveSupport::Testing::Deprecation + extend ActiveSupport::Testing::Declarative end end diff --git a/activesupport/lib/active_support/testing/assertions.rb b/activesupport/lib/active_support/testing/assertions.rb new file mode 100644 index 0000000000..ce2f44efd6 --- /dev/null +++ b/activesupport/lib/active_support/testing/assertions.rb @@ -0,0 +1,61 @@ +module ActiveSupport + module Testing + module Assertions + # Test numeric difference between the return value of an expression as a result of what is evaluated + # in the yielded block. + # + # assert_difference 'Article.count' do + # post :create, :article => {...} + # end + # + # An arbitrary expression is passed in and evaluated. + # + # assert_difference 'assigns(:article).comments(:reload).size' do + # post :create, :comment => {...} + # end + # + # An arbitrary positive or negative difference can be specified. The default is +1. + # + # assert_difference 'Article.count', -1 do + # post :delete, :id => ... + # end + # + # An array of expressions can also be passed in and evaluated. + # + # assert_difference [ 'Article.count', 'Post.count' ], +2 do + # post :create, :article => {...} + # end + # + # A error message can be specified. + # + # assert_difference 'Article.count', -1, "An Article should be destroyed" do + # post :delete, :id => ... + # end + def assert_difference(expressions, difference = 1, message = nil, &block) + expression_evaluations = Array(expressions).collect{ |expression| lambda { eval(expression, block.send(:binding)) } } + + original_values = expression_evaluations.inject([]) { |memo, expression| memo << expression.call } + yield + expression_evaluations.each_with_index do |expression, i| + assert_equal original_values[i] + difference, expression.call, message + end + end + + # Assertion that the numeric result of evaluating an expression is not changed before and after + # invoking the passed in block. + # + # assert_no_difference 'Article.count' do + # post :create, :article => invalid_attributes + # end + # + # A error message can be specified. + # + # assert_no_difference 'Article.count', "An Article should not be destroyed" do + # post :create, :article => invalid_attributes + # end + def assert_no_difference(expressions, message = nil, &block) + assert_difference expressions, 0, message, &block + end + end + end +end diff --git a/activesupport/lib/active_support/testing/declarative.rb b/activesupport/lib/active_support/testing/declarative.rb new file mode 100644 index 0000000000..cb6a5844eb --- /dev/null +++ b/activesupport/lib/active_support/testing/declarative.rb @@ -0,0 +1,21 @@ +module ActiveSupport + module Testing + module Declarative + # test "verify something" do + # ... + # end + def test(name, &block) + test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym + defined = instance_method(test_name) rescue false + raise "#{test_name} is already defined in #{self}" if defined + if block_given? + define_method(test_name, &block) + else + define_method(test_name) do + flunk "No implementation provided for #{name}" + end + end + end + end + end +end diff --git a/activesupport/lib/active_support/testing/deprecation.rb b/activesupport/lib/active_support/testing/deprecation.rb new file mode 100644 index 0000000000..e9220605bd --- /dev/null +++ b/activesupport/lib/active_support/testing/deprecation.rb @@ -0,0 +1,55 @@ +module ActiveSupport + module Testing + module Deprecation #:nodoc: + def assert_deprecated(match = nil, &block) + result, warnings = collect_deprecations(&block) + assert !warnings.empty?, "Expected a deprecation warning within the block but received none" + if match + match = Regexp.new(Regexp.escape(match)) unless match.is_a?(Regexp) + assert warnings.any? { |w| w =~ match }, "No deprecation warning matched #{match}: #{warnings.join(', ')}" + end + result + end + + def assert_not_deprecated(&block) + result, deprecations = collect_deprecations(&block) + assert deprecations.empty?, "Expected no deprecation warning within the block but received #{deprecations.size}: \n #{deprecations * "\n "}" + result + end + + private + def collect_deprecations + old_behavior = ActiveSupport::Deprecation.behavior + deprecations = [] + ActiveSupport::Deprecation.behavior = Proc.new do |message, callstack| + deprecations << message + end + result = yield + [result, deprecations] + ensure + ActiveSupport::Deprecation.behavior = old_behavior + end + end + end +end + +begin + require 'test/unit/error' + + module Test + module Unit + class Error # :nodoc: + # Silence warnings when reporting test errors. + def message_with_silenced_deprecation + ActiveSupport::Deprecation.silence do + message_without_silenced_deprecation + end + end + + alias_method_chain :message, :silenced_deprecation + end + end + end +rescue LoadError + # Using miniunit, ignore. +end diff --git a/activesupport/lib/active_support/testing/setup_and_teardown.rb b/activesupport/lib/active_support/testing/setup_and_teardown.rb index a514b61fea..245f57a7b0 100644 --- a/activesupport/lib/active_support/testing/setup_and_teardown.rb +++ b/activesupport/lib/active_support/testing/setup_and_teardown.rb @@ -1,119 +1,85 @@ +require 'active_support/callbacks' + module ActiveSupport module Testing module SetupAndTeardown - # For compatibility with Ruby < 1.8.6 - PASSTHROUGH_EXCEPTIONS = - if defined?(Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS) - Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS - else - [NoMemoryError, SignalException, Interrupt, SystemExit] - end - def self.included(base) base.class_eval do include ActiveSupport::Callbacks define_callbacks :setup, :teardown - if defined?(::Mini) - undef_method :run - alias_method :run, :run_with_callbacks_and_miniunit + if defined? MiniTest + include ForMiniTest else - begin - require 'mocha' - undef_method :run - alias_method :run, :run_with_callbacks_and_mocha - rescue LoadError - undef_method :run - alias_method :run, :run_with_callbacks_and_testunit - end + include ForClassicTestUnit end end end - def run_with_callbacks_and_miniunit(runner) - result = '.' - begin - run_callbacks :setup - result = super - rescue Exception => e - result = runner.puke(self.class, self.name, e) - ensure + module ForMiniTest + def run(runner) + result = '.' begin - teardown - run_callbacks :teardown, :enumerator => :reverse_each + run_callbacks :setup + result = super rescue Exception => e result = runner.puke(self.class, self.name, e) + ensure + begin + run_callbacks :teardown, :enumerator => :reverse_each + rescue Exception => e + result = runner.puke(self.class, self.name, e) + end end + result end - result end - # This redefinition is unfortunate but test/unit shows us no alternative. - def run_with_callbacks_and_testunit(result) #:nodoc: - return if @method_name.to_s == "default_test" + module ForClassicTestUnit + # For compatibility with Ruby < 1.8.6 + PASSTHROUGH_EXCEPTIONS = Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS rescue [NoMemoryError, SignalException, Interrupt, SystemExit] - yield(Test::Unit::TestCase::STARTED, name) - @_result = result - begin - run_callbacks :setup - setup - __send__(@method_name) - rescue Test::Unit::AssertionFailedError => e - add_failure(e.message, e.backtrace) - rescue *PASSTHROUGH_EXCEPTIONS - raise - rescue Exception - add_error($!) - ensure - begin - teardown - run_callbacks :teardown, :enumerator => :reverse_each - rescue Test::Unit::AssertionFailedError => e - add_failure(e.message, e.backtrace) - rescue *PASSTHROUGH_EXCEPTIONS - raise - rescue Exception - add_error($!) - end - end - result.add_run - yield(Test::Unit::TestCase::FINISHED, name) - end + # This redefinition is unfortunate but test/unit shows us no alternative. + # Doubly unfortunate: hax to support Mocha's hax. + def run(result) + return if @method_name.to_s == "default_test" - # Doubly unfortunate: mocha does the same so we have to hax their hax. - def run_with_callbacks_and_mocha(result) - return if @method_name.to_s == "default_test" + if using_mocha = respond_to?(:mocha_verify) + assertion_counter = Mocha::TestCaseAdapter::AssertionCounter.new(result) + end - yield(Test::Unit::TestCase::STARTED, name) - @_result = result - begin - mocha_setup + yield(Test::Unit::TestCase::STARTED, name) + @_result = result begin - run_callbacks :setup - setup - __send__(@method_name) - mocha_verify { add_assertion } - rescue Mocha::ExpectationError => e - add_failure(e.message, e.backtrace) - rescue Test::Unit::AssertionFailedError => e - add_failure(e.message, e.backtrace) - rescue StandardError, ScriptError - add_error($!) - ensure begin - teardown - run_callbacks :teardown, :enumerator => :reverse_each + run_callbacks :setup + setup + __send__(@method_name) + mocha_verify(assertion_counter) if using_mocha + rescue Mocha::ExpectationError => e + add_failure(e.message, e.backtrace) rescue Test::Unit::AssertionFailedError => e add_failure(e.message, e.backtrace) - rescue StandardError, ScriptError - add_error($!) + rescue Exception => e + raise if PASSTHROUGH_EXCEPTIONS.include?(e.class) + add_error(e) + ensure + begin + teardown + run_callbacks :teardown, :enumerator => :reverse_each + rescue Test::Unit::AssertionFailedError => e + add_failure(e.message, e.backtrace) + rescue Exception => e + raise if PASSTHROUGH_EXCEPTIONS.include?(e.class) + add_error(e) + end end + ensure + mocha_teardown if using_mocha end - ensure - mocha_teardown + result.add_run + yield(Test::Unit::TestCase::FINISHED, name) end - result.add_run - yield(Test::Unit::TestCase::FINISHED, name) end end end diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index a02cd81f72..9a2d283b30 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -1,4 +1,5 @@ require 'tzinfo' + module ActiveSupport # A Time-like class that can represent a time in any time zone. Necessary because standard Ruby Time instances are # limited to UTC and the system's <tt>ENV['TZ']</tt> zone. diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index 1d87fa64b5..836f469df7 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -288,6 +288,7 @@ module ActiveSupport # TODO: Preload instead of lazy load for thread safety def tzinfo + require 'tzinfo' unless defined?(TZInfo) @tzinfo ||= TZInfo::Timezone.get(MAPPING[name]) end diff --git a/activesupport/lib/active_support/vendor.rb b/activesupport/lib/active_support/vendor.rb index dc98936525..463610722c 100644 --- a/activesupport/lib/active_support/vendor.rb +++ b/activesupport/lib/active_support/vendor.rb @@ -6,12 +6,7 @@ begin rescue Gem::LoadError $:.unshift "#{File.dirname(__FILE__)}/vendor/builder-2.1.2" end - -begin - gem 'xml-simple', '~> 1.0.11' -rescue Gem::LoadError - $:.unshift "#{File.dirname(__FILE__)}/vendor/xml-simple-1.0.11" -end +require 'builder' begin gem 'memcache-client', '~> 1.5.1' @@ -20,9 +15,9 @@ rescue Gem::LoadError end begin - gem 'tzinfo', '~> 0.3.11' + gem 'tzinfo', '~> 0.3.12' rescue Gem::LoadError - $:.unshift "#{File.dirname(__FILE__)}/vendor/tzinfo-0.3.11" + $:.unshift "#{File.dirname(__FILE__)}/vendor/tzinfo-0.3.12" end # TODO I18n gem has not been released yet @@ -31,4 +26,4 @@ end # rescue Gem::LoadError $:.unshift "#{File.dirname(__FILE__)}/vendor/i18n-0.0.1" require 'i18n' -# end
\ No newline at end of file +# end diff --git a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb index 40e82d8225..2ffe3618b5 100755 --- a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb +++ b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb @@ -11,7 +11,7 @@ require 'i18n/exceptions' module I18n @@backend = nil @@load_path = nil - @@default_locale = :'en-US' + @@default_locale = :'en' @@exception_handler = :default_exception_handler class << self @@ -25,7 +25,7 @@ module I18n @@backend = backend end - # Returns the current default locale. Defaults to 'en-US' + # Returns the current default locale. Defaults to 'en' def default_locale @@default_locale end @@ -57,7 +57,7 @@ module I18n # files which are either named *.rb and contain plain Ruby Hashes or are # named *.yml and contain YAML data. So for the SimpleBackend clients may # register translation files like this: - # I18n.load_path << 'path/to/locale/en-US.yml' + # I18n.load_path << 'path/to/locale/en.yml' def load_path @@load_path ||= [] end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Argentina/San_Juan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Argentina/San_Juan.rb deleted file mode 100644 index 4a9663684d..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Argentina/San_Juan.rb +++ /dev/null @@ -1,170 +0,0 @@ -require 'tzinfo/timezone_definition' - -module TZInfo - module Definitions - module America - module Argentina - module San_Juan - include TimezoneDefinition - - timezone 'America/Argentina/San_Juan' do |tz| - tz.offset :o0, -16444, 0, :LMT - tz.offset :o1, -15408, 0, :CMT - tz.offset :o2, -14400, 0, :ART - tz.offset :o3, -14400, 3600, :ARST - tz.offset :o4, -10800, 0, :ART - tz.offset :o5, -10800, 3600, :ARST - tz.offset :o6, -14400, 0, :WART - - tz.transition 1894, 10, :o1, 52123666111, 21600 - tz.transition 1920, 5, :o2, 1453467407, 600 - tz.transition 1930, 12, :o3, 7278935, 3 - tz.transition 1931, 4, :o2, 19411461, 8 - tz.transition 1931, 10, :o3, 7279889, 3 - tz.transition 1932, 3, :o2, 19414141, 8 - tz.transition 1932, 11, :o3, 7281038, 3 - tz.transition 1933, 3, :o2, 19417061, 8 - tz.transition 1933, 11, :o3, 7282133, 3 - tz.transition 1934, 3, :o2, 19419981, 8 - tz.transition 1934, 11, :o3, 7283228, 3 - tz.transition 1935, 3, :o2, 19422901, 8 - tz.transition 1935, 11, :o3, 7284323, 3 - tz.transition 1936, 3, :o2, 19425829, 8 - tz.transition 1936, 11, :o3, 7285421, 3 - tz.transition 1937, 3, :o2, 19428749, 8 - tz.transition 1937, 11, :o3, 7286516, 3 - tz.transition 1938, 3, :o2, 19431669, 8 - tz.transition 1938, 11, :o3, 7287611, 3 - tz.transition 1939, 3, :o2, 19434589, 8 - tz.transition 1939, 11, :o3, 7288706, 3 - tz.transition 1940, 3, :o2, 19437517, 8 - tz.transition 1940, 7, :o3, 7289435, 3 - tz.transition 1941, 6, :o2, 19441285, 8 - tz.transition 1941, 10, :o3, 7290848, 3 - tz.transition 1943, 8, :o2, 19447501, 8 - tz.transition 1943, 10, :o3, 7293038, 3 - tz.transition 1946, 3, :o2, 19455045, 8 - tz.transition 1946, 10, :o3, 7296284, 3 - tz.transition 1963, 10, :o2, 19506429, 8 - tz.transition 1963, 12, :o3, 7315136, 3 - tz.transition 1964, 3, :o2, 19507645, 8 - tz.transition 1964, 10, :o3, 7316051, 3 - tz.transition 1965, 3, :o2, 19510565, 8 - tz.transition 1965, 10, :o3, 7317146, 3 - tz.transition 1966, 3, :o2, 19513485, 8 - tz.transition 1966, 10, :o3, 7318241, 3 - tz.transition 1967, 4, :o2, 19516661, 8 - tz.transition 1967, 10, :o3, 7319294, 3 - tz.transition 1968, 4, :o2, 19519629, 8 - tz.transition 1968, 10, :o3, 7320407, 3 - tz.transition 1969, 4, :o2, 19522541, 8 - tz.transition 1969, 10, :o4, 7321499, 3 - tz.transition 1974, 1, :o5, 128142000 - tz.transition 1974, 5, :o4, 136605600 - tz.transition 1988, 12, :o5, 596948400 - tz.transition 1989, 3, :o4, 605066400 - tz.transition 1989, 10, :o5, 624423600 - tz.transition 1990, 3, :o4, 636516000 - tz.transition 1990, 10, :o5, 656478000 - tz.transition 1991, 3, :o6, 667792800 - tz.transition 1991, 5, :o4, 673588800 - tz.transition 1991, 10, :o5, 687927600 - tz.transition 1992, 3, :o4, 699415200 - tz.transition 1992, 10, :o5, 719377200 - tz.transition 1993, 3, :o4, 731469600 - tz.transition 1999, 10, :o3, 938919600 - tz.transition 2000, 3, :o4, 952052400 - tz.transition 2004, 5, :o6, 1085972400 - tz.transition 2004, 7, :o4, 1090728000 - tz.transition 2007, 12, :o5, 1198983600 - tz.transition 2008, 3, :o4, 1205632800 - tz.transition 2008, 10, :o5, 1224385200 - tz.transition 2009, 3, :o4, 1237082400 - tz.transition 2009, 10, :o5, 1255834800 - tz.transition 2010, 3, :o4, 1269136800 - tz.transition 2010, 10, :o5, 1287284400 - tz.transition 2011, 3, :o4, 1300586400 - tz.transition 2011, 10, :o5, 1318734000 - tz.transition 2012, 3, :o4, 1332036000 - tz.transition 2012, 10, :o5, 1350788400 - tz.transition 2013, 3, :o4, 1363485600 - tz.transition 2013, 10, :o5, 1382238000 - tz.transition 2014, 3, :o4, 1394935200 - tz.transition 2014, 10, :o5, 1413687600 - tz.transition 2015, 3, :o4, 1426384800 - tz.transition 2015, 10, :o5, 1445137200 - tz.transition 2016, 3, :o4, 1458439200 - tz.transition 2016, 10, :o5, 1476586800 - tz.transition 2017, 3, :o4, 1489888800 - tz.transition 2017, 10, :o5, 1508036400 - tz.transition 2018, 3, :o4, 1521338400 - tz.transition 2018, 10, :o5, 1540090800 - tz.transition 2019, 3, :o4, 1552788000 - tz.transition 2019, 10, :o5, 1571540400 - tz.transition 2020, 3, :o4, 1584237600 - tz.transition 2020, 10, :o5, 1602990000 - tz.transition 2021, 3, :o4, 1616292000 - tz.transition 2021, 10, :o5, 1634439600 - tz.transition 2022, 3, :o4, 1647741600 - tz.transition 2022, 10, :o5, 1665889200 - tz.transition 2023, 3, :o4, 1679191200 - tz.transition 2023, 10, :o5, 1697338800 - tz.transition 2024, 3, :o4, 1710640800 - tz.transition 2024, 10, :o5, 1729393200 - tz.transition 2025, 3, :o4, 1742090400 - tz.transition 2025, 10, :o5, 1760842800 - tz.transition 2026, 3, :o4, 1773540000 - tz.transition 2026, 10, :o5, 1792292400 - tz.transition 2027, 3, :o4, 1805594400 - tz.transition 2027, 10, :o5, 1823742000 - tz.transition 2028, 3, :o4, 1837044000 - tz.transition 2028, 10, :o5, 1855191600 - tz.transition 2029, 3, :o4, 1868493600 - tz.transition 2029, 10, :o5, 1887246000 - tz.transition 2030, 3, :o4, 1899943200 - tz.transition 2030, 10, :o5, 1918695600 - tz.transition 2031, 3, :o4, 1931392800 - tz.transition 2031, 10, :o5, 1950145200 - tz.transition 2032, 3, :o4, 1963447200 - tz.transition 2032, 10, :o5, 1981594800 - tz.transition 2033, 3, :o4, 1994896800 - tz.transition 2033, 10, :o5, 2013044400 - tz.transition 2034, 3, :o4, 2026346400 - tz.transition 2034, 10, :o5, 2044494000 - tz.transition 2035, 3, :o4, 2057796000 - tz.transition 2035, 10, :o5, 2076548400 - tz.transition 2036, 3, :o4, 2089245600 - tz.transition 2036, 10, :o5, 2107998000 - tz.transition 2037, 3, :o4, 2120695200 - tz.transition 2037, 10, :o5, 2139447600 - tz.transition 2038, 3, :o4, 29586043, 12 - tz.transition 2038, 10, :o5, 19725709, 8 - tz.transition 2039, 3, :o4, 29590411, 12 - tz.transition 2039, 10, :o5, 19728621, 8 - tz.transition 2040, 3, :o4, 29594779, 12 - tz.transition 2040, 10, :o5, 19731589, 8 - tz.transition 2041, 3, :o4, 29599147, 12 - tz.transition 2041, 10, :o5, 19734501, 8 - tz.transition 2042, 3, :o4, 29603515, 12 - tz.transition 2042, 10, :o5, 19737413, 8 - tz.transition 2043, 3, :o4, 29607883, 12 - tz.transition 2043, 10, :o5, 19740325, 8 - tz.transition 2044, 3, :o4, 29612335, 12 - tz.transition 2044, 10, :o5, 19743237, 8 - tz.transition 2045, 3, :o4, 29616703, 12 - tz.transition 2045, 10, :o5, 19746149, 8 - tz.transition 2046, 3, :o4, 29621071, 12 - tz.transition 2046, 10, :o5, 19749117, 8 - tz.transition 2047, 3, :o4, 29625439, 12 - tz.transition 2047, 10, :o5, 19752029, 8 - tz.transition 2048, 3, :o4, 29629807, 12 - tz.transition 2048, 10, :o5, 19754941, 8 - tz.transition 2049, 3, :o4, 29634259, 12 - tz.transition 2049, 10, :o5, 19757853, 8 - tz.transition 2050, 3, :o4, 29638627, 12 - end - end - end - end - end -end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo.rb index c8bdbeec5d..c8bdbeec5d 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/data_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone.rb index 5eccbdf0db..5eccbdf0db 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/data_timezone.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/data_timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone_info.rb index a45d94554b..a45d94554b 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/data_timezone_info.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone_info.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Algiers.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Algiers.rb index 8c5f25577f..8c5f25577f 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Algiers.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Algiers.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Cairo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Cairo.rb index 6e6daf3522..6e6daf3522 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Cairo.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Cairo.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Casablanca.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Casablanca.rb index d1eb5c5724..d1eb5c5724 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Casablanca.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Casablanca.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Harare.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Harare.rb index 070c95ae0f..070c95ae0f 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Harare.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Harare.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Johannesburg.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Johannesburg.rb index f0af0d8e33..f0af0d8e33 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Johannesburg.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Johannesburg.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Monrovia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Monrovia.rb index 40e711fa44..40e711fa44 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Monrovia.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Monrovia.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Nairobi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Nairobi.rb index 7b0a2f43be..7b0a2f43be 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Africa/Nairobi.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Nairobi.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Argentina/Buenos_Aires.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/Buenos_Aires.rb index 8f4dd31dbb..8f4dd31dbb 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/Buenos_Aires.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb new file mode 100644 index 0000000000..ba8be4705f --- /dev/null +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb @@ -0,0 +1,86 @@ +require 'tzinfo/timezone_definition' + +module TZInfo + module Definitions + module America + module Argentina + module San_Juan + include TimezoneDefinition + + timezone 'America/Argentina/San_Juan' do |tz| + tz.offset :o0, -16444, 0, :LMT + tz.offset :o1, -15408, 0, :CMT + tz.offset :o2, -14400, 0, :ART + tz.offset :o3, -14400, 3600, :ARST + tz.offset :o4, -10800, 0, :ART + tz.offset :o5, -10800, 3600, :ARST + tz.offset :o6, -14400, 0, :WART + + tz.transition 1894, 10, :o1, 52123666111, 21600 + tz.transition 1920, 5, :o2, 1453467407, 600 + tz.transition 1930, 12, :o3, 7278935, 3 + tz.transition 1931, 4, :o2, 19411461, 8 + tz.transition 1931, 10, :o3, 7279889, 3 + tz.transition 1932, 3, :o2, 19414141, 8 + tz.transition 1932, 11, :o3, 7281038, 3 + tz.transition 1933, 3, :o2, 19417061, 8 + tz.transition 1933, 11, :o3, 7282133, 3 + tz.transition 1934, 3, :o2, 19419981, 8 + tz.transition 1934, 11, :o3, 7283228, 3 + tz.transition 1935, 3, :o2, 19422901, 8 + tz.transition 1935, 11, :o3, 7284323, 3 + tz.transition 1936, 3, :o2, 19425829, 8 + tz.transition 1936, 11, :o3, 7285421, 3 + tz.transition 1937, 3, :o2, 19428749, 8 + tz.transition 1937, 11, :o3, 7286516, 3 + tz.transition 1938, 3, :o2, 19431669, 8 + tz.transition 1938, 11, :o3, 7287611, 3 + tz.transition 1939, 3, :o2, 19434589, 8 + tz.transition 1939, 11, :o3, 7288706, 3 + tz.transition 1940, 3, :o2, 19437517, 8 + tz.transition 1940, 7, :o3, 7289435, 3 + tz.transition 1941, 6, :o2, 19441285, 8 + tz.transition 1941, 10, :o3, 7290848, 3 + tz.transition 1943, 8, :o2, 19447501, 8 + tz.transition 1943, 10, :o3, 7293038, 3 + tz.transition 1946, 3, :o2, 19455045, 8 + tz.transition 1946, 10, :o3, 7296284, 3 + tz.transition 1963, 10, :o2, 19506429, 8 + tz.transition 1963, 12, :o3, 7315136, 3 + tz.transition 1964, 3, :o2, 19507645, 8 + tz.transition 1964, 10, :o3, 7316051, 3 + tz.transition 1965, 3, :o2, 19510565, 8 + tz.transition 1965, 10, :o3, 7317146, 3 + tz.transition 1966, 3, :o2, 19513485, 8 + tz.transition 1966, 10, :o3, 7318241, 3 + tz.transition 1967, 4, :o2, 19516661, 8 + tz.transition 1967, 10, :o3, 7319294, 3 + tz.transition 1968, 4, :o2, 19519629, 8 + tz.transition 1968, 10, :o3, 7320407, 3 + tz.transition 1969, 4, :o2, 19522541, 8 + tz.transition 1969, 10, :o4, 7321499, 3 + tz.transition 1974, 1, :o5, 128142000 + tz.transition 1974, 5, :o4, 136605600 + tz.transition 1988, 12, :o5, 596948400 + tz.transition 1989, 3, :o4, 605066400 + tz.transition 1989, 10, :o5, 624423600 + tz.transition 1990, 3, :o4, 636516000 + tz.transition 1990, 10, :o5, 656478000 + tz.transition 1991, 3, :o6, 667792800 + tz.transition 1991, 5, :o4, 673588800 + tz.transition 1991, 10, :o5, 687927600 + tz.transition 1992, 3, :o4, 699415200 + tz.transition 1992, 10, :o5, 719377200 + tz.transition 1993, 3, :o4, 731469600 + tz.transition 1999, 10, :o3, 938919600 + tz.transition 2000, 3, :o4, 952052400 + tz.transition 2004, 5, :o6, 1085972400 + tz.transition 2004, 7, :o4, 1090728000 + tz.transition 2007, 12, :o5, 1198983600 + tz.transition 2008, 3, :o4, 1205632800 + end + end + end + end + end +end diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Bogota.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Bogota.rb index ef96435c6a..ef96435c6a 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Bogota.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Bogota.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Caracas.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Caracas.rb index 27392a540a..27392a540a 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Caracas.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Caracas.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Chicago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chicago.rb index 0996857cf0..0996857cf0 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Chicago.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chicago.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Chihuahua.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chihuahua.rb index 1710b57c79..1710b57c79 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Chihuahua.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chihuahua.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Denver.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Denver.rb index 1c1efb5ff3..1c1efb5ff3 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Denver.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Denver.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Godthab.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Godthab.rb index 1e05518b0d..1e05518b0d 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Godthab.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Godthab.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Guatemala.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Guatemala.rb index a2bf73401c..a2bf73401c 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Guatemala.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Guatemala.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Halifax.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Halifax.rb index d25ae775b3..d25ae775b3 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Halifax.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Halifax.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Indiana/Indianapolis.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Indiana/Indianapolis.rb index f1430f6c24..f1430f6c24 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Indiana/Indianapolis.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Indiana/Indianapolis.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Juneau.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Juneau.rb index f646f3f54a..f646f3f54a 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Juneau.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Juneau.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/La_Paz.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/La_Paz.rb index 45c907899f..45c907899f 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/La_Paz.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/La_Paz.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Lima.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Lima.rb index af68ac29f7..af68ac29f7 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Lima.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Lima.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Los_Angeles.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Los_Angeles.rb index 16007fd675..16007fd675 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Los_Angeles.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Los_Angeles.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Mazatlan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mazatlan.rb index ba9e6efcf1..ba9e6efcf1 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Mazatlan.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mazatlan.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Mexico_City.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mexico_City.rb index 2347fce647..2347fce647 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Mexico_City.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mexico_City.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Monterrey.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Monterrey.rb index 5816a9eab1..5816a9eab1 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Monterrey.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Monterrey.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/New_York.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/New_York.rb index 7d802bd2de..7d802bd2de 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/New_York.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/New_York.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Phoenix.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Phoenix.rb index b514e0c0f9..b514e0c0f9 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Phoenix.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Phoenix.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Regina.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Regina.rb index ebdb68814a..ebdb68814a 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Regina.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Regina.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Santiago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Santiago.rb index 0287c9ebc4..0287c9ebc4 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Santiago.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Santiago.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Sao_Paulo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Sao_Paulo.rb index 0524f81c04..0524f81c04 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Sao_Paulo.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Sao_Paulo.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/St_Johns.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/St_Johns.rb index e4a3599d35..e4a3599d35 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/St_Johns.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/St_Johns.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Tijuana.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Tijuana.rb index 423059da46..423059da46 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Tijuana.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Tijuana.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Almaty.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Almaty.rb index 9ee18970f1..9ee18970f1 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Almaty.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Almaty.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Baghdad.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baghdad.rb index 774dca1587..774dca1587 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Baghdad.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baghdad.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Baku.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baku.rb index e86340ebfa..e86340ebfa 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Baku.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baku.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Bangkok.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Bangkok.rb index 139194e5e5..139194e5e5 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Bangkok.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Bangkok.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Chongqing.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Chongqing.rb index 8c94b4ba86..8c94b4ba86 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Chongqing.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Chongqing.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Colombo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb index f6531fa819..f6531fa819 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Colombo.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Dhaka.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Dhaka.rb index ccd0265503..ccd0265503 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Dhaka.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Dhaka.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Hong_Kong.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Hong_Kong.rb index f1edd75ac8..f1edd75ac8 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Hong_Kong.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Hong_Kong.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Irkutsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Irkutsk.rb index 2d47d9580b..2d47d9580b 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Irkutsk.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Irkutsk.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Jakarta.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jakarta.rb index cc58fa173b..cc58fa173b 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Jakarta.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jakarta.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Jerusalem.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jerusalem.rb index 9b737b899e..9b737b899e 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Jerusalem.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jerusalem.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kabul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kabul.rb index 669c09790a..669c09790a 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kabul.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kabul.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kamchatka.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kamchatka.rb index 2f1690b3a9..2f1690b3a9 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kamchatka.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kamchatka.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Karachi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Karachi.rb index b906cc9893..b906cc9893 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Karachi.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Karachi.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Katmandu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Katmandu.rb index 37dbea1f41..37dbea1f41 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Katmandu.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Katmandu.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kolkata.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kolkata.rb index 1b6ffbd59d..1b6ffbd59d 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kolkata.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kolkata.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Krasnoyarsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Krasnoyarsk.rb index d6c503c155..d6c503c155 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Krasnoyarsk.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Krasnoyarsk.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kuala_Lumpur.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuala_Lumpur.rb index 77a0c206fa..77a0c206fa 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kuala_Lumpur.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuala_Lumpur.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kuwait.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuwait.rb index 5bd5283197..5bd5283197 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Kuwait.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuwait.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Magadan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Magadan.rb index 302093693e..302093693e 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Magadan.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Magadan.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Muscat.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Muscat.rb index 604f651dfa..604f651dfa 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Muscat.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Muscat.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Novosibirsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Novosibirsk.rb index a4e7796e75..a4e7796e75 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Novosibirsk.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Novosibirsk.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Rangoon.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Rangoon.rb index 759b82d77a..759b82d77a 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Rangoon.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Rangoon.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Riyadh.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Riyadh.rb index 7add410620..7add410620 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Riyadh.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Riyadh.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Seoul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Seoul.rb index 795d2a75df..795d2a75df 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Seoul.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Seoul.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Shanghai.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Shanghai.rb index 34b13d59ae..34b13d59ae 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Shanghai.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Shanghai.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Singapore.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Singapore.rb index b323a78f74..b323a78f74 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Singapore.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Singapore.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Taipei.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Taipei.rb index 3ba12108fb..3ba12108fb 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Taipei.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Taipei.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Tashkent.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tashkent.rb index c205c7934d..c205c7934d 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Tashkent.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tashkent.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Tbilisi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tbilisi.rb index 15792a5651..15792a5651 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Tbilisi.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tbilisi.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Tehran.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tehran.rb index d8df964a46..d8df964a46 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Tehran.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tehran.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Tokyo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tokyo.rb index 51c9e16421..51c9e16421 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Tokyo.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tokyo.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Ulaanbaatar.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Ulaanbaatar.rb index 2854f5c5fd..2854f5c5fd 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Ulaanbaatar.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Ulaanbaatar.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Urumqi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Urumqi.rb index d793ff1341..d793ff1341 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Urumqi.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Urumqi.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Vladivostok.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Vladivostok.rb index bd9e3d60ec..bd9e3d60ec 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Vladivostok.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Vladivostok.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Yakutsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yakutsk.rb index 56435a788f..56435a788f 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Yakutsk.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yakutsk.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Yekaterinburg.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yekaterinburg.rb index 8ef8df4a41..8ef8df4a41 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Yekaterinburg.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yekaterinburg.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Yerevan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yerevan.rb index e7f160861f..e7f160861f 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Asia/Yerevan.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yerevan.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Atlantic/Azores.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Azores.rb index 1bd16a75ac..1bd16a75ac 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Atlantic/Azores.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Azores.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Atlantic/Cape_Verde.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Cape_Verde.rb index 61c8c15043..61c8c15043 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Atlantic/Cape_Verde.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Cape_Verde.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Atlantic/South_Georgia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/South_Georgia.rb index 6a4cbafb9f..6a4cbafb9f 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Atlantic/South_Georgia.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/South_Georgia.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Adelaide.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Adelaide.rb index c5d561cc1e..c5d561cc1e 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Adelaide.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Adelaide.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Brisbane.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Brisbane.rb index dd85ddae94..dd85ddae94 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Brisbane.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Brisbane.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Darwin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Darwin.rb index 17de88124d..17de88124d 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Darwin.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Darwin.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Hobart.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Hobart.rb index 11384b9840..11384b9840 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Hobart.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Hobart.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Melbourne.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Melbourne.rb index c1304488ea..c1304488ea 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Melbourne.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Melbourne.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Perth.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Perth.rb index d9e66f14a8..d9e66f14a8 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Perth.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Perth.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Sydney.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Sydney.rb index 9062bd7c3c..9062bd7c3c 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Australia/Sydney.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Sydney.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Etc/UTC.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Etc/UTC.rb index 28b2c6a04c..28b2c6a04c 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Etc/UTC.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Etc/UTC.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Amsterdam.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Amsterdam.rb index 2d0c95c4bc..2d0c95c4bc 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Amsterdam.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Amsterdam.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Athens.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Athens.rb index 4e21e535ca..4e21e535ca 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Athens.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Athens.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Belgrade.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Belgrade.rb index 4dbd893d75..4dbd893d75 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Belgrade.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Belgrade.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Berlin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Berlin.rb index 721054236c..721054236c 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Berlin.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Berlin.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Bratislava.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bratislava.rb index 7a731a0b6a..7a731a0b6a 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Bratislava.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bratislava.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Brussels.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Brussels.rb index 6b0a242944..6b0a242944 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Brussels.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Brussels.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Bucharest.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bucharest.rb index 521c3c932e..521c3c932e 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Bucharest.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bucharest.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Budapest.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Budapest.rb index 1f3a9738b7..1f3a9738b7 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Budapest.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Budapest.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Copenhagen.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Copenhagen.rb index 47cbaf14a7..47cbaf14a7 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Copenhagen.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Copenhagen.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Dublin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Dublin.rb index 0560bb5436..0560bb5436 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Dublin.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Dublin.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Helsinki.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Helsinki.rb index 13a806bcc7..13a806bcc7 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Helsinki.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Helsinki.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Istanbul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Istanbul.rb index 8306c47536..8306c47536 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Istanbul.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Istanbul.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Kiev.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Kiev.rb index 513d3308be..513d3308be 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Kiev.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Kiev.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Lisbon.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Lisbon.rb index 1c6d2a3d30..1c6d2a3d30 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Lisbon.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Lisbon.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Ljubljana.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Ljubljana.rb index a9828e6ef8..a9828e6ef8 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Ljubljana.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Ljubljana.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/London.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/London.rb index 64ce41e900..64ce41e900 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/London.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/London.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Madrid.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Madrid.rb index 1fb568239a..1fb568239a 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Madrid.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Madrid.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Minsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Minsk.rb index fa15816cc8..fa15816cc8 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Minsk.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Minsk.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Moscow.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Moscow.rb index ef269b675b..ef269b675b 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Moscow.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Moscow.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Paris.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Paris.rb index e3236c0ba1..e3236c0ba1 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Paris.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Paris.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Prague.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Prague.rb index bcabee96c1..bcabee96c1 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Prague.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Prague.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Riga.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Riga.rb index 784837f758..784837f758 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Riga.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Riga.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Rome.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Rome.rb index aa7b43d9d2..aa7b43d9d2 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Rome.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Rome.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Sarajevo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sarajevo.rb index 068c5fe6ad..068c5fe6ad 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Sarajevo.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sarajevo.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Skopje.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Skopje.rb index 10b71f285e..10b71f285e 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Skopje.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Skopje.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Sofia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sofia.rb index 38a70eceb9..38a70eceb9 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Sofia.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sofia.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Stockholm.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Stockholm.rb index 43db70fa61..43db70fa61 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Stockholm.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Stockholm.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Tallinn.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Tallinn.rb index de5a8569f3..de5a8569f3 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Tallinn.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Tallinn.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Vienna.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vienna.rb index 990aabab66..990aabab66 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Vienna.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vienna.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Vilnius.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vilnius.rb index d89d095a75..d89d095a75 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Vilnius.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vilnius.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Warsaw.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Warsaw.rb index 7fa51c2691..7fa51c2691 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Warsaw.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Warsaw.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Zagreb.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Zagreb.rb index ecdd903d28..ecdd903d28 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Europe/Zagreb.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Zagreb.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Auckland.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Auckland.rb index a524fd6b6b..a524fd6b6b 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Auckland.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Auckland.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Fiji.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Fiji.rb index 5fe9bbd9a6..5fe9bbd9a6 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Fiji.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Fiji.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Guam.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Guam.rb index d4c1a0a682..d4c1a0a682 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Guam.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Guam.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Honolulu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Honolulu.rb index 204b226537..204b226537 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Honolulu.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Honolulu.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Majuro.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Majuro.rb index 32adad92c1..32adad92c1 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Majuro.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Majuro.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Midway.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Midway.rb index 97784fcc10..97784fcc10 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Midway.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Midway.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Noumea.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Noumea.rb index 70173db8ab..70173db8ab 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Noumea.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Noumea.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Pago_Pago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Pago_Pago.rb index c8fcd7d527..c8fcd7d527 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Pago_Pago.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Pago_Pago.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Port_Moresby.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Port_Moresby.rb index f06cf6d54f..f06cf6d54f 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Port_Moresby.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Port_Moresby.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Tongatapu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Tongatapu.rb index 7578d92f38..7578d92f38 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/Pacific/Tongatapu.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Tongatapu.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/info_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/info_timezone.rb index 001303c594..001303c594 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/info_timezone.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/info_timezone.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/linked_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone.rb index f8ec4fca87..f8ec4fca87 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/linked_timezone.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/linked_timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone_info.rb index 8197ff3e81..8197ff3e81 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/linked_timezone_info.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone_info.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/offset_rationals.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/offset_rationals.rb index b1f10b2b63..b1f10b2b63 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/offset_rationals.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/offset_rationals.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/ruby_core_support.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/ruby_core_support.rb index 9a0441206b..9a0441206b 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/ruby_core_support.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/ruby_core_support.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/time_or_datetime.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb index 264517f3ee..264517f3ee 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/time_or_datetime.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone.rb index f87fb6fb70..f87fb6fb70 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_definition.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_definition.rb index 39ca8bfa53..39ca8bfa53 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_definition.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_definition.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_info.rb index 68e38c35fb..68e38c35fb 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_info.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_info.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_offset_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_offset_info.rb index 6a0bbca46f..6a0bbca46f 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_offset_info.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_offset_info.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_period.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_period.rb index 00888fcfdc..00888fcfdc 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_period.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_period.rb diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_transition_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_transition_info.rb index 6b0669cc4a..6b0669cc4a 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/timezone_transition_info.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_transition_info.rb diff --git a/activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb b/activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb deleted file mode 100644 index ec6dab513f..0000000000 --- a/activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb +++ /dev/null @@ -1,1021 +0,0 @@ -# = XmlSimple -# -# Author:: Maik Schmidt <contact@maik-schmidt.de> -# Copyright:: Copyright (c) 2003-2006 Maik Schmidt -# License:: Distributes under the same terms as Ruby. -# -require 'rexml/document' -require 'stringio' - -# Easy API to maintain XML (especially configuration files). -class XmlSimple - include REXML - - @@VERSION = '1.0.11' - - # A simple cache for XML documents that were already transformed - # by xml_in. - class Cache - # Creates and initializes a new Cache object. - def initialize - @mem_share_cache = {} - @mem_copy_cache = {} - end - - # Saves a data structure into a file. - # - # data:: - # Data structure to be saved. - # filename:: - # Name of the file belonging to the data structure. - def save_storable(data, filename) - cache_file = get_cache_filename(filename) - File.open(cache_file, "w+") { |f| Marshal.dump(data, f) } - end - - # Restores a data structure from a file. If restoring the data - # structure failed for any reason, nil will be returned. - # - # filename:: - # Name of the file belonging to the data structure. - def restore_storable(filename) - cache_file = get_cache_filename(filename) - return nil unless File::exist?(cache_file) - return nil unless File::mtime(cache_file).to_i > File::mtime(filename).to_i - data = nil - File.open(cache_file) { |f| data = Marshal.load(f) } - data - end - - # Saves a data structure in a shared memory cache. - # - # data:: - # Data structure to be saved. - # filename:: - # Name of the file belonging to the data structure. - def save_mem_share(data, filename) - @mem_share_cache[filename] = [Time::now.to_i, data] - end - - # Restores a data structure from a shared memory cache. You - # should consider these elements as "read only". If restoring - # the data structure failed for any reason, nil will be - # returned. - # - # filename:: - # Name of the file belonging to the data structure. - def restore_mem_share(filename) - get_from_memory_cache(filename, @mem_share_cache) - end - - # Copies a data structure to a memory cache. - # - # data:: - # Data structure to be copied. - # filename:: - # Name of the file belonging to the data structure. - def save_mem_copy(data, filename) - @mem_share_cache[filename] = [Time::now.to_i, Marshal.dump(data)] - end - - # Restores a data structure from a memory cache. If restoring - # the data structure failed for any reason, nil will be - # returned. - # - # filename:: - # Name of the file belonging to the data structure. - def restore_mem_copy(filename) - data = get_from_memory_cache(filename, @mem_share_cache) - data = Marshal.load(data) unless data.nil? - data - end - - private - - # Returns the "cache filename" belonging to a filename, i.e. - # the extension '.xml' in the original filename will be replaced - # by '.stor'. If filename does not have this extension, '.stor' - # will be appended. - # - # filename:: - # Filename to get "cache filename" for. - def get_cache_filename(filename) - filename.sub(/(\.xml)?$/, '.stor') - end - - # Returns a cache entry from a memory cache belonging to a - # certain filename. If no entry could be found for any reason, - # nil will be returned. - # - # filename:: - # Name of the file the cache entry belongs to. - # cache:: - # Memory cache to get entry from. - def get_from_memory_cache(filename, cache) - return nil unless cache[filename] - return nil unless cache[filename][0] > File::mtime(filename).to_i - return cache[filename][1] - end - end - - # Create a "global" cache. - @@cache = Cache.new - - # Creates and initializes a new XmlSimple object. - # - # defaults:: - # Default values for options. - def initialize(defaults = nil) - unless defaults.nil? || defaults.instance_of?(Hash) - raise ArgumentError, "Options have to be a Hash." - end - @default_options = normalize_option_names(defaults, (KNOWN_OPTIONS['in'] + KNOWN_OPTIONS['out']).uniq) - @options = Hash.new - @_var_values = nil - end - - # Converts an XML document in the same way as the Perl module XML::Simple. - # - # string:: - # XML source. Could be one of the following: - # - # - nil: Tries to load and parse '<scriptname>.xml'. - # - filename: Tries to load and parse filename. - # - IO object: Reads from object until EOF is detected and parses result. - # - XML string: Parses string. - # - # options:: - # Options to be used. - def xml_in(string = nil, options = nil) - handle_options('in', options) - - # If no XML string or filename was supplied look for scriptname.xml. - if string.nil? - string = File::basename($0) - string.sub!(/\.[^.]+$/, '') - string += '.xml' - - directory = File::dirname($0) - @options['searchpath'].unshift(directory) unless directory.nil? - end - - if string.instance_of?(String) - if string =~ /<.*?>/m - @doc = parse(string) - elsif string == '-' - @doc = parse($stdin.readlines.to_s) - else - filename = find_xml_file(string, @options['searchpath']) - - if @options.has_key?('cache') - @options['cache'].each { |scheme| - case(scheme) - when 'storable' - content = @@cache.restore_storable(filename) - when 'mem_share' - content = @@cache.restore_mem_share(filename) - when 'mem_copy' - content = @@cache.restore_mem_copy(filename) - else - raise ArgumentError, "Unsupported caching scheme: <#{scheme}>." - end - return content if content - } - end - - @doc = load_xml_file(filename) - end - elsif string.kind_of?(IO) || string.kind_of?(StringIO) - @doc = parse(string.readlines.to_s) - else - raise ArgumentError, "Could not parse object of type: <#{string.type}>." - end - - result = collapse(@doc.root) - result = @options['keeproot'] ? merge({}, @doc.root.name, result) : result - put_into_cache(result, filename) - result - end - - # This is the functional version of the instance method xml_in. - def XmlSimple.xml_in(string = nil, options = nil) - xml_simple = XmlSimple.new - xml_simple.xml_in(string, options) - end - - # Converts a data structure into an XML document. - # - # ref:: - # Reference to data structure to be converted into XML. - # options:: - # Options to be used. - def xml_out(ref, options = nil) - handle_options('out', options) - if ref.instance_of?(Array) - ref = { @options['anonymoustag'] => ref } - end - - if @options['keeproot'] - keys = ref.keys - if keys.size == 1 - ref = ref[keys[0]] - @options['rootname'] = keys[0] - end - elsif @options['rootname'] == '' - if ref.instance_of?(Hash) - refsave = ref - ref = {} - refsave.each { |key, value| - if !scalar(value) - ref[key] = value - else - ref[key] = [ value.to_s ] - end - } - end - end - - @ancestors = [] - xml = value_to_xml(ref, @options['rootname'], '') - @ancestors = nil - - if @options['xmldeclaration'] - xml = @options['xmldeclaration'] + "\n" + xml - end - - if @options.has_key?('outputfile') - if @options['outputfile'].kind_of?(IO) - return @options['outputfile'].write(xml) - else - File.open(@options['outputfile'], "w") { |file| file.write(xml) } - end - end - xml - end - - # This is the functional version of the instance method xml_out. - def XmlSimple.xml_out(hash, options = nil) - xml_simple = XmlSimple.new - xml_simple.xml_out(hash, options) - end - - private - - # Declare options that are valid for xml_in and xml_out. - KNOWN_OPTIONS = { - 'in' => %w( - keyattr keeproot forcecontent contentkey noattr - searchpath forcearray suppressempty anonymoustag - cache grouptags normalisespace normalizespace - variables varattr keytosymbol - ), - 'out' => %w( - keyattr keeproot contentkey noattr rootname - xmldeclaration outputfile noescape suppressempty - anonymoustag indent grouptags noindent - ) - } - - # Define some reasonable defaults. - DEF_KEY_ATTRIBUTES = [] - DEF_ROOT_NAME = 'opt' - DEF_CONTENT_KEY = 'content' - DEF_XML_DECLARATION = "<?xml version='1.0' standalone='yes'?>" - DEF_ANONYMOUS_TAG = 'anon' - DEF_FORCE_ARRAY = true - DEF_INDENTATION = ' ' - DEF_KEY_TO_SYMBOL = false - - # Normalizes option names in a hash, i.e., turns all - # characters to lower case and removes all underscores. - # Additionally, this method checks, if an unknown option - # was used and raises an according exception. - # - # options:: - # Hash to be normalized. - # known_options:: - # List of known options. - def normalize_option_names(options, known_options) - return nil if options.nil? - result = Hash.new - options.each { |key, value| - lkey = key.downcase - lkey.gsub!(/_/, '') - if !known_options.member?(lkey) - raise ArgumentError, "Unrecognised option: #{lkey}." - end - result[lkey] = value - } - result - end - - # Merges a set of options with the default options. - # - # direction:: - # 'in': If options should be handled for xml_in. - # 'out': If options should be handled for xml_out. - # options:: - # Options to be merged with the default options. - def handle_options(direction, options) - @options = options || Hash.new - - raise ArgumentError, "Options must be a Hash!" unless @options.instance_of?(Hash) - - unless KNOWN_OPTIONS.has_key?(direction) - raise ArgumentError, "Unknown direction: <#{direction}>." - end - - known_options = KNOWN_OPTIONS[direction] - @options = normalize_option_names(@options, known_options) - - unless @default_options.nil? - known_options.each { |option| - unless @options.has_key?(option) - if @default_options.has_key?(option) - @options[option] = @default_options[option] - end - end - } - end - - unless @options.has_key?('noattr') - @options['noattr'] = false - end - - if @options.has_key?('rootname') - @options['rootname'] = '' if @options['rootname'].nil? - else - @options['rootname'] = DEF_ROOT_NAME - end - - if @options.has_key?('xmldeclaration') && @options['xmldeclaration'] == true - @options['xmldeclaration'] = DEF_XML_DECLARATION - end - - @options['keytosymbol'] = DEF_KEY_TO_SYMBOL unless @options.has_key?('keytosymbol') - - if @options.has_key?('contentkey') - if @options['contentkey'] =~ /^-(.*)$/ - @options['contentkey'] = $1 - @options['collapseagain'] = true - end - else - @options['contentkey'] = DEF_CONTENT_KEY - end - - unless @options.has_key?('normalisespace') - @options['normalisespace'] = @options['normalizespace'] - end - @options['normalisespace'] = 0 if @options['normalisespace'].nil? - - if @options.has_key?('searchpath') - unless @options['searchpath'].instance_of?(Array) - @options['searchpath'] = [ @options['searchpath'] ] - end - else - @options['searchpath'] = [] - end - - if @options.has_key?('cache') && scalar(@options['cache']) - @options['cache'] = [ @options['cache'] ] - end - - @options['anonymoustag'] = DEF_ANONYMOUS_TAG unless @options.has_key?('anonymoustag') - - if !@options.has_key?('indent') || @options['indent'].nil? - @options['indent'] = DEF_INDENTATION - end - - @options['indent'] = '' if @options.has_key?('noindent') - - # Special cleanup for 'keyattr' which could be an array or - # a hash or left to default to array. - if @options.has_key?('keyattr') - if !scalar(@options['keyattr']) - # Convert keyattr => { elem => '+attr' } - # to keyattr => { elem => ['attr', '+'] } - if @options['keyattr'].instance_of?(Hash) - @options['keyattr'].each { |key, value| - if value =~ /^([-+])?(.*)$/ - @options['keyattr'][key] = [$2, $1 ? $1 : ''] - end - } - elsif !@options['keyattr'].instance_of?(Array) - raise ArgumentError, "'keyattr' must be String, Hash, or Array!" - end - else - @options['keyattr'] = [ @options['keyattr'] ] - end - else - @options['keyattr'] = DEF_KEY_ATTRIBUTES - end - - if @options.has_key?('forcearray') - if @options['forcearray'].instance_of?(Regexp) - @options['forcearray'] = [ @options['forcearray'] ] - end - - if @options['forcearray'].instance_of?(Array) - force_list = @options['forcearray'] - unless force_list.empty? - @options['forcearray'] = {} - force_list.each { |tag| - if tag.instance_of?(Regexp) - unless @options['forcearray']['_regex'].instance_of?(Array) - @options['forcearray']['_regex'] = [] - end - @options['forcearray']['_regex'] << tag - else - @options['forcearray'][tag] = true - end - } - else - @options['forcearray'] = false - end - else - @options['forcearray'] = @options['forcearray'] ? true : false - end - else - @options['forcearray'] = DEF_FORCE_ARRAY - end - - if @options.has_key?('grouptags') && !@options['grouptags'].instance_of?(Hash) - raise ArgumentError, "Illegal value for 'GroupTags' option - expected a Hash." - end - - if @options.has_key?('variables') && !@options['variables'].instance_of?(Hash) - raise ArgumentError, "Illegal value for 'Variables' option - expected a Hash." - end - - if @options.has_key?('variables') - @_var_values = @options['variables'] - elsif @options.has_key?('varattr') - @_var_values = {} - end - end - - # Actually converts an XML document element into a data structure. - # - # element:: - # The document element to be collapsed. - def collapse(element) - result = @options['noattr'] ? {} : get_attributes(element) - - if @options['normalisespace'] == 2 - result.each { |k, v| result[k] = normalise_space(v) } - end - - if element.has_elements? - element.each_element { |child| - value = collapse(child) - if empty(value) && (element.attributes.empty? || @options['noattr']) - next if @options.has_key?('suppressempty') && @options['suppressempty'] == true - end - result = merge(result, child.name, value) - } - if has_mixed_content?(element) - # normalisespace? - content = element.texts.map { |x| x.to_s } - content = content[0] if content.size == 1 - result[@options['contentkey']] = content - end - elsif element.has_text? # i.e. it has only text. - return collapse_text_node(result, element) - end - - # Turn Arrays into Hashes if key fields present. - count = fold_arrays(result) - - # Disintermediate grouped tags. - if @options.has_key?('grouptags') - result.each { |key, value| - next unless (value.instance_of?(Hash) && (value.size == 1)) - child_key, child_value = value.to_a[0] - if @options['grouptags'][key] == child_key - result[key] = child_value - end - } - end - - # Fold Hashes containing a single anonymous Array up into just the Array. - if count == 1 - anonymoustag = @options['anonymoustag'] - if result.has_key?(anonymoustag) && result[anonymoustag].instance_of?(Array) - return result[anonymoustag] - end - end - - if result.empty? && @options.has_key?('suppressempty') - return @options['suppressempty'] == '' ? '' : nil - end - - result - end - - # Collapses a text node and merges it with an existing Hash, if - # possible. - # Thanks to Curtis Schofield for reporting a subtle bug. - # - # hash:: - # Hash to merge text node value with, if possible. - # element:: - # Text node to be collapsed. - def collapse_text_node(hash, element) - value = node_to_text(element) - if empty(value) && !element.has_attributes? - return {} - end - - if element.has_attributes? && !@options['noattr'] - return merge(hash, @options['contentkey'], value) - else - if @options['forcecontent'] - return merge(hash, @options['contentkey'], value) - else - return value - end - end - end - - # Folds all arrays in a Hash. - # - # hash:: - # Hash to be folded. - def fold_arrays(hash) - fold_amount = 0 - keyattr = @options['keyattr'] - if (keyattr.instance_of?(Array) || keyattr.instance_of?(Hash)) - hash.each { |key, value| - if value.instance_of?(Array) - if keyattr.instance_of?(Array) - hash[key] = fold_array(value) - else - hash[key] = fold_array_by_name(key, value) - end - fold_amount += 1 - end - } - end - fold_amount - end - - # Folds an Array to a Hash, if possible. Folding happens - # according to the content of keyattr, which has to be - # an array. - # - # array:: - # Array to be folded. - def fold_array(array) - hash = Hash.new - array.each { |x| - return array unless x.instance_of?(Hash) - key_matched = false - @options['keyattr'].each { |key| - if x.has_key?(key) - key_matched = true - value = x[key] - return array if value.instance_of?(Hash) || value.instance_of?(Array) - value = normalise_space(value) if @options['normalisespace'] == 1 - x.delete(key) - hash[value] = x - break - end - } - return array unless key_matched - } - hash = collapse_content(hash) if @options['collapseagain'] - hash - end - - # Folds an Array to a Hash, if possible. Folding happens - # according to the content of keyattr, which has to be - # a Hash. - # - # name:: - # Name of the attribute to be folded upon. - # array:: - # Array to be folded. - def fold_array_by_name(name, array) - return array unless @options['keyattr'].has_key?(name) - key, flag = @options['keyattr'][name] - - hash = Hash.new - array.each { |x| - if x.instance_of?(Hash) && x.has_key?(key) - value = x[key] - return array if value.instance_of?(Hash) || value.instance_of?(Array) - value = normalise_space(value) if @options['normalisespace'] == 1 - hash[value] = x - hash[value]["-#{key}"] = hash[value][key] if flag == '-' - hash[value].delete(key) unless flag == '+' - else - $stderr.puts("Warning: <#{name}> element has no '#{key}' attribute.") - return array - end - } - hash = collapse_content(hash) if @options['collapseagain'] - hash - end - - # Tries to collapse a Hash even more ;-) - # - # hash:: - # Hash to be collapsed again. - def collapse_content(hash) - content_key = @options['contentkey'] - hash.each_value { |value| - return hash unless value.instance_of?(Hash) && value.size == 1 && value.has_key?(content_key) - hash.each_key { |key| hash[key] = hash[key][content_key] } - } - hash - end - - # Adds a new key/value pair to an existing Hash. If the key to be added - # does already exist and the existing value associated with key is not - # an Array, it will be converted into an Array. Then the new value is - # appended to that Array. - # - # hash:: - # Hash to add key/value pair to. - # key:: - # Key to be added. - # value:: - # Value to be associated with key. - def merge(hash, key, value) - if value.instance_of?(String) - value = normalise_space(value) if @options['normalisespace'] == 2 - - # do variable substitutions - unless @_var_values.nil? || @_var_values.empty? - value.gsub!(/\$\{(\w+)\}/) { |x| get_var($1) } - end - - # look for variable definitions - if @options.has_key?('varattr') - varattr = @options['varattr'] - if hash.has_key?(varattr) - set_var(hash[varattr], value) - end - end - end - - #patch for converting keys to symbols - if @options.has_key?('keytosymbol') - if @options['keytosymbol'] == true - key = key.to_s.downcase.to_sym - end - end - - if hash.has_key?(key) - if hash[key].instance_of?(Array) - hash[key] << value - else - hash[key] = [ hash[key], value ] - end - elsif value.instance_of?(Array) # Handle anonymous arrays. - hash[key] = [ value ] - else - if force_array?(key) - hash[key] = [ value ] - else - hash[key] = value - end - end - hash - end - - # Checks, if the 'forcearray' option has to be used for - # a certain key. - def force_array?(key) - return false if key == @options['contentkey'] - return true if @options['forcearray'] == true - forcearray = @options['forcearray'] - if forcearray.instance_of?(Hash) - return true if forcearray.has_key?(key) - return false unless forcearray.has_key?('_regex') - forcearray['_regex'].each { |x| return true if key =~ x } - end - return false - end - - # Converts the attributes array of a document node into a Hash. - # Returns an empty Hash, if node has no attributes. - # - # node:: - # Document node to extract attributes from. - def get_attributes(node) - attributes = {} - node.attributes.each { |n,v| attributes[n] = v } - attributes - end - - # Determines, if a document element has mixed content. - # - # element:: - # Document element to be checked. - def has_mixed_content?(element) - if element.has_text? && element.has_elements? - return true if element.texts.join('') !~ /^\s*$/s - end - false - end - - # Called when a variable definition is encountered in the XML. - # A variable definition looks like - # <element attrname="name">value</element> - # where attrname matches the varattr setting. - def set_var(name, value) - @_var_values[name] = value - end - - # Called during variable substitution to get the value for the - # named variable. - def get_var(name) - if @_var_values.has_key?(name) - return @_var_values[name] - else - return "${#{name}}" - end - end - - # Recurses through a data structure building up and returning an - # XML representation of that structure as a string. - # - # ref:: - # Reference to the data structure to be encoded. - # name:: - # The XML tag name to be used for this item. - # indent:: - # A string of spaces for use as the current indent level. - def value_to_xml(ref, name, indent) - named = !name.nil? && name != '' - nl = @options.has_key?('noindent') ? '' : "\n" - - if !scalar(ref) - if @ancestors.member?(ref) - raise ArgumentError, "Circular data structures not supported!" - end - @ancestors << ref - else - if named - return [indent, '<', name, '>', @options['noescape'] ? ref.to_s : escape_value(ref.to_s), '</', name, '>', nl].join('') - else - return ref.to_s + nl - end - end - - # Unfold hash to array if possible. - if ref.instance_of?(Hash) && !ref.empty? && !@options['keyattr'].empty? && indent != '' - ref = hash_to_array(name, ref) - end - - result = [] - if ref.instance_of?(Hash) - # Reintermediate grouped values if applicable. - if @options.has_key?('grouptags') - ref.each { |key, value| - if @options['grouptags'].has_key?(key) - ref[key] = { @options['grouptags'][key] => value } - end - } - end - - nested = [] - text_content = nil - if named - result << indent << '<' << name - end - - if !ref.empty? - ref.each { |key, value| - next if !key.nil? && key[0, 1] == '-' - if value.nil? - unless @options.has_key?('suppressempty') && @options['suppressempty'].nil? - raise ArgumentError, "Use of uninitialized value!" - end - value = {} - end - - if !scalar(value) || @options['noattr'] - nested << value_to_xml(value, key, indent + @options['indent']) - else - value = value.to_s - value = escape_value(value) unless @options['noescape'] - if key == @options['contentkey'] - text_content = value - else - result << ' ' << key << '="' << value << '"' - end - end - } - else - text_content = '' - end - - if !nested.empty? || !text_content.nil? - if named - result << '>' - if !text_content.nil? - result << text_content - nested[0].sub!(/^\s+/, '') if !nested.empty? - else - result << nl - end - if !nested.empty? - result << nested << indent - end - result << '</' << name << '>' << nl - else - result << nested - end - else - result << ' />' << nl - end - elsif ref.instance_of?(Array) - ref.each { |value| - if scalar(value) - result << indent << '<' << name << '>' - result << (@options['noescape'] ? value.to_s : escape_value(value.to_s)) - result << '</' << name << '>' << nl - elsif value.instance_of?(Hash) - result << value_to_xml(value, name, indent) - else - result << indent << '<' << name << '>' << nl - result << value_to_xml(value, @options['anonymoustag'], indent + @options['indent']) - result << indent << '</' << name << '>' << nl - end - } - else - # Probably, this is obsolete. - raise ArgumentError, "Can't encode a value of type: #{ref.type}." - end - @ancestors.pop if !scalar(ref) - result.join('') - end - - # Checks, if a certain value is a "scalar" value. Whatever - # that will be in Ruby ... ;-) - # - # value:: - # Value to be checked. - def scalar(value) - return false if value.instance_of?(Hash) || value.instance_of?(Array) - return true - end - - # Attempts to unfold a hash of hashes into an array of hashes. Returns - # a reference to th array on success or the original hash, if unfolding - # is not possible. - # - # parent:: - # - # hashref:: - # Reference to the hash to be unfolded. - def hash_to_array(parent, hashref) - arrayref = [] - hashref.each { |key, value| - return hashref unless value.instance_of?(Hash) - - if @options['keyattr'].instance_of?(Hash) - return hashref unless @options['keyattr'].has_key?(parent) - arrayref << { @options['keyattr'][parent][0] => key }.update(value) - else - arrayref << { @options['keyattr'][0] => key }.update(value) - end - } - arrayref - end - - # Replaces XML markup characters by their external entities. - # - # data:: - # The string to be escaped. - def escape_value(data) - Text::normalize(data) - end - - # Removes leading and trailing whitespace and sequences of - # whitespaces from a string. - # - # text:: - # String to be normalised. - def normalise_space(text) - text.strip.gsub(/\s\s+/, ' ') - end - - # Checks, if an object is nil, an empty String or an empty Hash. - # Thanks to Norbert Gawor for a bugfix. - # - # value:: - # Value to be checked for emptiness. - def empty(value) - case value - when Hash - return value.empty? - when String - return value !~ /\S/m - else - return value.nil? - end - end - - # Converts a document node into a String. - # If the node could not be converted into a String - # for any reason, default will be returned. - # - # node:: - # Document node to be converted. - # default:: - # Value to be returned, if node could not be converted. - def node_to_text(node, default = nil) - if node.instance_of?(REXML::Element) - node.texts.map { |t| t.value }.join('') - elsif node.instance_of?(REXML::Attribute) - node.value.nil? ? default : node.value.strip - elsif node.instance_of?(REXML::Text) - node.value.strip - else - default - end - end - - # Parses an XML string and returns the according document. - # - # xml_string:: - # XML string to be parsed. - # - # The following exception may be raised: - # - # REXML::ParseException:: - # If the specified file is not wellformed. - def parse(xml_string) - Document.new(xml_string) - end - - # Searches in a list of paths for a certain file. Returns - # the full path to the file, if it could be found. Otherwise, - # an exception will be raised. - # - # filename:: - # Name of the file to search for. - # searchpath:: - # List of paths to search in. - def find_xml_file(file, searchpath) - filename = File::basename(file) - - if filename != file - return file if File::file?(file) - else - searchpath.each { |path| - full_path = File::join(path, filename) - return full_path if File::file?(full_path) - } - end - - if searchpath.empty? - return file if File::file?(file) - raise ArgumentError, "File does not exist: #{file}." - end - raise ArgumentError, "Could not find <#{filename}> in <#{searchpath.join(':')}>" - end - - # Loads and parses an XML configuration file. - # - # filename:: - # Name of the configuration file to be loaded. - # - # The following exceptions may be raised: - # - # Errno::ENOENT:: - # If the specified file does not exist. - # REXML::ParseException:: - # If the specified file is not wellformed. - def load_xml_file(filename) - parse(File.readlines(filename).to_s) - end - - # Caches the data belonging to a certain file. - # - # data:: - # Data to be cached. - # filename:: - # Name of file the data was read from. - def put_into_cache(data, filename) - if @options.has_key?('cache') - @options['cache'].each { |scheme| - case(scheme) - when 'storable' - @@cache.save_storable(data, filename) - when 'mem_share' - @@cache.save_mem_share(data, filename) - when 'mem_copy' - @@cache.save_mem_copy(data, filename) - else - raise ArgumentError, "Unsupported caching scheme: <#{scheme}>." - end - } - end - end -end - -# vim:sw=2 diff --git a/activesupport/lib/active_support/version.rb b/activesupport/lib/active_support/version.rb index 6631f233f1..3e2b29b327 100644 --- a/activesupport/lib/active_support/version.rb +++ b/activesupport/lib/active_support/version.rb @@ -1,8 +1,8 @@ module ActiveSupport module VERSION #:nodoc: MAJOR = 2 - MINOR = 2 - TINY = 1 + MINOR = 3 + TINY = 0 STRING = [MAJOR, MINOR, TINY].join('.') end diff --git a/activesupport/lib/active_support/xml_mini.rb b/activesupport/lib/active_support/xml_mini.rb new file mode 100644 index 0000000000..bfc3d7b00b --- /dev/null +++ b/activesupport/lib/active_support/xml_mini.rb @@ -0,0 +1,111 @@ +# = XmlMini +# This is a derivitive work of XmlSimple 1.0.11 +# Author:: Joseph Holsten <joseph@josephholsten.com> +# Copyright:: Copyright (c) 2008 Joseph Holsten +# Copyright:: Copyright (c) 2003-2006 Maik Schmidt <contact@maik-schmidt.de> +# License:: Distributes under the same terms as Ruby. +module XmlMini + extend self + + CONTENT_KEY = '__content__'.freeze + + # Parse an XML Document string into a simple hash + # + # Same as XmlSimple::xml_in but doesn't shoot itself in the foot, + # and uses the defaults from ActiveSupport + # + # string:: + # XML Document string to parse + def parse(string) + require 'rexml/document' unless defined?(REXML::Document) + doc = REXML::Document.new(string) + merge_element!({}, doc.root) + end + + private + # Convert an XML element and merge into the hash + # + # hash:: + # Hash to merge the converted element into. + # element:: + # XML element to merge into hash + def merge_element!(hash, element) + merge!(hash, element.name, collapse(element)) + end + + # Actually converts an XML document element into a data structure. + # + # element:: + # The document element to be collapsed. + def collapse(element) + hash = get_attributes(element) + + if element.has_elements? + element.each_element {|child| merge_element!(hash, child) } + merge_texts!(hash, element) unless empty_content?(element) + hash + else + merge_texts!(hash, element) + end + end + + # Merge all the texts of an element into the hash + # + # hash:: + # Hash to add the converted emement to. + # element:: + # XML element whose texts are to me merged into the hash + def merge_texts!(hash, element) + unless element.has_text? + hash + else + # must use value to prevent double-escaping + merge!(hash, CONTENT_KEY, element.texts.sum(&:value)) + end + end + + # Adds a new key/value pair to an existing Hash. If the key to be added + # already exists and the existing value associated with key is not + # an Array, it will be wrapped in an Array. Then the new value is + # appended to that Array. + # + # hash:: + # Hash to add key/value pair to. + # key:: + # Key to be added. + # value:: + # Value to be associated with key. + def merge!(hash, key, value) + if hash.has_key?(key) + if hash[key].instance_of?(Array) + hash[key] << value + else + hash[key] = [hash[key], value] + end + elsif value.instance_of?(Array) + hash[key] = [value] + else + hash[key] = value + end + hash + end + + # Converts the attributes array of an XML element into a hash. + # Returns an empty Hash if node has no attributes. + # + # element:: + # XML element to extract attributes from. + def get_attributes(element) + attributes = {} + element.attributes.each { |n,v| attributes[n] = v } + attributes + end + + # Determines if a document element has text content + # + # element:: + # XML element to be checked. + def empty_content?(element) + element.texts.join.blank? + end +end diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index 9d8c252f86..ac362d14c8 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -1,44 +1,20 @@ -# encoding: utf-8 - +require 'rubygems' require 'test/unit' +gem 'mocha', '>= 0.9.3' +require 'mocha' $:.unshift "#{File.dirname(__FILE__)}/../lib" -$:.unshift File.dirname(__FILE__) require 'active_support' +require 'active_support/test_case' -if RUBY_VERSION < '1.9' - $KCODE = 'UTF8' -end - -def uses_gem(gem_name, test_name, version = '> 0') - require 'rubygems' - gem gem_name.to_s, version - require gem_name.to_s +def uses_memcached(test_name) + require 'memcache' + MemCache.new('localhost').stats yield -rescue LoadError - $stderr.puts "Skipping #{test_name} tests. `gem install #{gem_name}` and try again." -end - -# Wrap tests that use Mocha and skip if unavailable. -unless defined? uses_mocha - def uses_mocha(test_name, &block) - uses_gem('mocha', test_name, '>= 0.5.5', &block) - end -end - -unless defined? uses_memcached - def uses_memcached(test_name) - require 'memcache' - MemCache.new('localhost').stats - yield - rescue MemCache::MemCacheError - $stderr.puts "Skipping #{test_name} tests. Start memcached and try again." - end +rescue MemCache::MemCacheError + $stderr.puts "Skipping #{test_name} tests. Start memcached and try again." end -# Show backtraces for deprecated behavior for quicker cleanup. -ActiveSupport::Deprecation.debug = true - def with_kcode(code) if RUBY_VERSION < '1.9' begin @@ -51,3 +27,10 @@ def with_kcode(code) yield end end + +# Show backtraces for deprecated behavior for quicker cleanup. +ActiveSupport::Deprecation.debug = true + +if RUBY_VERSION < '1.9' + $KCODE = 'UTF8' +end diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index e7dac4cc6b..d8506de986 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -45,29 +45,27 @@ class CacheStoreSettingTest < Test::Unit::TestCase end end -uses_mocha 'high-level cache store tests' do - class CacheStoreTest < Test::Unit::TestCase - def setup - @cache = ActiveSupport::Cache.lookup_store(:memory_store) - end +class CacheStoreTest < Test::Unit::TestCase + def setup + @cache = ActiveSupport::Cache.lookup_store(:memory_store) + end - def test_fetch_without_cache_miss - @cache.stubs(:read).with('foo', {}).returns('bar') - @cache.expects(:write).never - assert_equal 'bar', @cache.fetch('foo') { 'baz' } - end + def test_fetch_without_cache_miss + @cache.stubs(:read).with('foo', {}).returns('bar') + @cache.expects(:write).never + assert_equal 'bar', @cache.fetch('foo') { 'baz' } + end - def test_fetch_with_cache_miss - @cache.stubs(:read).with('foo', {}).returns(nil) - @cache.expects(:write).with('foo', 'baz', {}) - assert_equal 'baz', @cache.fetch('foo') { 'baz' } - end + def test_fetch_with_cache_miss + @cache.stubs(:read).with('foo', {}).returns(nil) + @cache.expects(:write).with('foo', 'baz', {}) + assert_equal 'baz', @cache.fetch('foo') { 'baz' } + end - def test_fetch_with_forced_cache_miss - @cache.expects(:read).never - @cache.expects(:write).with('foo', 'bar', :force => true) - @cache.fetch('foo', :force => true) { 'bar' } - end + def test_fetch_with_forced_cache_miss + @cache.expects(:read).never + @cache.expects(:write).with('foo', 'bar', :force => true) + @cache.fetch('foo', :force => true) { 'bar' } end end diff --git a/activesupport/test/clean_backtrace_test.rb b/activesupport/test/clean_backtrace_test.rb new file mode 100644 index 0000000000..ddbc258df1 --- /dev/null +++ b/activesupport/test/clean_backtrace_test.rb @@ -0,0 +1,47 @@ +require 'abstract_unit' + +class BacktraceCleanerFilterTest < ActiveSupport::TestCase + def setup + @bc = ActiveSupport::BacktraceCleaner.new + @bc.add_filter { |line| line.gsub("/my/prefix", '') } + end + + test "backtrace should not contain prefix when it has been filtered out" do + assert_equal "/my/class.rb", @bc.clean([ "/my/prefix/my/class.rb" ]).first + end + + test "backtrace should contain unaltered lines if they dont match a filter" do + assert_equal "/my/other_prefix/my/class.rb", @bc.clean([ "/my/other_prefix/my/class.rb" ]).first + end + + test "backtrace should filter all lines in a backtrace" do + assert_equal \ + ["/my/class.rb", "/my/module.rb"], + @bc.clean([ "/my/prefix/my/class.rb", "/my/prefix/my/module.rb" ]) + end +end + +class BacktraceCleanerSilencerTest < ActiveSupport::TestCase + def setup + @bc = ActiveSupport::BacktraceCleaner.new + @bc.add_silencer { |line| line =~ /mongrel/ } + end + + test "backtrace should not contain lines that match the silencer" do + assert_equal \ + [ "/other/class.rb" ], + @bc.clean([ "/mongrel/class.rb", "/other/class.rb", "/mongrel/stuff.rb" ]) + end +end + +class BacktraceCleanerFilterAndSilencerTest < ActiveSupport::TestCase + def setup + @bc = ActiveSupport::BacktraceCleaner.new + @bc.add_filter { |line| line.gsub("/mongrel", "") } + @bc.add_silencer { |line| line =~ /mongrel/ } + end + + test "backtrace should not silence lines that has first had their silence hook filtered out" do + assert_equal [ "/class.rb" ], @bc.clean([ "/mongrel/class.rb" ]) + end +end
\ No newline at end of file diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index 62a1f61d53..01b243cdb5 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -15,17 +15,13 @@ class ArrayExtAccessTests < Test::Unit::TestCase end def test_second_through_tenth - array = (1..10).to_a + array = (1..42).to_a assert_equal array[1], array.second assert_equal array[2], array.third assert_equal array[3], array.fourth assert_equal array[4], array.fifth - assert_equal array[5], array.sixth - assert_equal array[6], array.seventh - assert_equal array[7], array.eighth - assert_equal array[8], array.ninth - assert_equal array[9], array.tenth + assert_equal array[41], array.forty_two end end @@ -294,16 +290,14 @@ class ArrayExtractOptionsTests < Test::Unit::TestCase end end -uses_mocha "ArrayExtRandomTests" do - class ArrayExtRandomTests < Test::Unit::TestCase - def test_random_element_from_array - assert_nil [].rand +class ArrayExtRandomTests < Test::Unit::TestCase + def test_random_element_from_array + assert_nil [].rand - Kernel.expects(:rand).with(1).returns(0) - assert_equal 'x', ['x'].rand + Kernel.expects(:rand).with(1).returns(0) + assert_equal 'x', ['x'].rand - Kernel.expects(:rand).with(3).returns(1) - assert_equal 2, [1, 2, 3].rand - end + Kernel.expects(:rand).with(3).returns(1) + assert_equal 2, [1, 2, 3].rand end end diff --git a/activesupport/test/core_ext/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb index b53c754780..2cedf65153 100644 --- a/activesupport/test/core_ext/date_ext_test.rb +++ b/activesupport/test/core_ext/date_ext_test.rb @@ -210,50 +210,46 @@ class DateExtCalculationsTest < Test::Unit::TestCase end end - uses_mocha 'past?, today? and future?' do - def test_today - Date.stubs(:current).returns(Date.new(2000, 1, 1)) - assert_equal false, Date.new(1999, 12, 31).today? - assert_equal true, Date.new(2000,1,1).today? - assert_equal false, Date.new(2000,1,2).today? - end - - def test_past - Date.stubs(:current).returns(Date.new(2000, 1, 1)) - assert_equal true, Date.new(1999, 12, 31).past? - assert_equal false, Date.new(2000,1,1).past? - assert_equal false, Date.new(2000,1,2).past? - end - - def test_future - Date.stubs(:current).returns(Date.new(2000, 1, 1)) - assert_equal false, Date.new(1999, 12, 31).future? - assert_equal false, Date.new(2000,1,1).future? - assert_equal true, Date.new(2000,1,2).future? + def test_today + Date.stubs(:current).returns(Date.new(2000, 1, 1)) + assert_equal false, Date.new(1999, 12, 31).today? + assert_equal true, Date.new(2000,1,1).today? + assert_equal false, Date.new(2000,1,2).today? + end + + def test_past + Date.stubs(:current).returns(Date.new(2000, 1, 1)) + assert_equal true, Date.new(1999, 12, 31).past? + assert_equal false, Date.new(2000,1,1).past? + assert_equal false, Date.new(2000,1,2).past? + end + + def test_future + Date.stubs(:current).returns(Date.new(2000, 1, 1)) + assert_equal false, Date.new(1999, 12, 31).future? + assert_equal false, Date.new(2000,1,1).future? + assert_equal true, Date.new(2000,1,2).future? + end + + def test_current_returns_date_today_when_zone_default_not_set + with_env_tz 'US/Central' do + Time.stubs(:now).returns Time.local(1999, 12, 31, 23) + assert_equal Date.new(1999, 12, 31), Date.today + assert_equal Date.new(1999, 12, 31), Date.current end end - uses_mocha 'TestDateCurrent' do - def test_current_returns_date_today_when_zone_default_not_set + def test_current_returns_time_zone_today_when_zone_default_set + silence_warnings do # silence warnings raised by tzinfo gem + Time.zone_default = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] with_env_tz 'US/Central' do Time.stubs(:now).returns Time.local(1999, 12, 31, 23) assert_equal Date.new(1999, 12, 31), Date.today - assert_equal Date.new(1999, 12, 31), Date.current - end - end - - def test_current_returns_time_zone_today_when_zone_default_set - silence_warnings do # silence warnings raised by tzinfo gem - Time.zone_default = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] - with_env_tz 'US/Central' do - Time.stubs(:now).returns Time.local(1999, 12, 31, 23) - assert_equal Date.new(1999, 12, 31), Date.today - assert_equal Date.new(2000, 1, 1), Date.current - end + assert_equal Date.new(2000, 1, 1), Date.current end - ensure - Time.zone_default = nil end + ensure + Time.zone_default = nil end protected diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb index be3cd8b5d6..45eb52c720 100644 --- a/activesupport/test/core_ext/date_time_ext_test.rb +++ b/activesupport/test/core_ext/date_time_ext_test.rb @@ -207,69 +207,65 @@ class DateTimeExtCalculationsTest < Test::Unit::TestCase assert_match(/^2080-02-28T15:15:10-06:?00$/, DateTime.civil(2080, 2, 28, 15, 15, 10, -0.25).xmlschema) end - uses_mocha 'Test DateTime past?, today? and future?' do - def test_today_with_offset - Date.stubs(:current).returns(Date.new(2000, 1, 1)) - assert_equal false, DateTime.civil(1999,12,31,23,59,59, Rational(-18000, 86400)).today? - assert_equal true, DateTime.civil(2000,1,1,0,0,0, Rational(-18000, 86400)).today? - assert_equal true, DateTime.civil(2000,1,1,23,59,59, Rational(-18000, 86400)).today? - assert_equal false, DateTime.civil(2000,1,2,0,0,0, Rational(-18000, 86400)).today? - end - - def test_today_without_offset - Date.stubs(:current).returns(Date.new(2000, 1, 1)) - assert_equal false, DateTime.civil(1999,12,31,23,59,59).today? - assert_equal true, DateTime.civil(2000,1,1,0).today? - assert_equal true, DateTime.civil(2000,1,1,23,59,59).today? - assert_equal false, DateTime.civil(2000,1,2,0).today? - end - - def test_past_with_offset - DateTime.stubs(:current).returns(DateTime.civil(2005,2,10,15,30,45, Rational(-18000, 86400))) - assert_equal true, DateTime.civil(2005,2,10,15,30,44, Rational(-18000, 86400)).past? - assert_equal false, DateTime.civil(2005,2,10,15,30,45, Rational(-18000, 86400)).past? - assert_equal false, DateTime.civil(2005,2,10,15,30,46, Rational(-18000, 86400)).past? - end - - def test_past_without_offset - DateTime.stubs(:current).returns(DateTime.civil(2005,2,10,15,30,45, Rational(-18000, 86400))) - assert_equal true, DateTime.civil(2005,2,10,20,30,44).past? - assert_equal false, DateTime.civil(2005,2,10,20,30,45).past? - assert_equal false, DateTime.civil(2005,2,10,20,30,46).past? - end - - def test_future_with_offset - DateTime.stubs(:current).returns(DateTime.civil(2005,2,10,15,30,45, Rational(-18000, 86400))) - assert_equal false, DateTime.civil(2005,2,10,15,30,44, Rational(-18000, 86400)).future? - assert_equal false, DateTime.civil(2005,2,10,15,30,45, Rational(-18000, 86400)).future? - assert_equal true, DateTime.civil(2005,2,10,15,30,46, Rational(-18000, 86400)).future? - end - - def test_future_without_offset - DateTime.stubs(:current).returns(DateTime.civil(2005,2,10,15,30,45, Rational(-18000, 86400))) - assert_equal false, DateTime.civil(2005,2,10,20,30,44).future? - assert_equal false, DateTime.civil(2005,2,10,20,30,45).future? - assert_equal true, DateTime.civil(2005,2,10,20,30,46).future? - end + def test_today_with_offset + Date.stubs(:current).returns(Date.new(2000, 1, 1)) + assert_equal false, DateTime.civil(1999,12,31,23,59,59, Rational(-18000, 86400)).today? + assert_equal true, DateTime.civil(2000,1,1,0,0,0, Rational(-18000, 86400)).today? + assert_equal true, DateTime.civil(2000,1,1,23,59,59, Rational(-18000, 86400)).today? + assert_equal false, DateTime.civil(2000,1,2,0,0,0, Rational(-18000, 86400)).today? + end + + def test_today_without_offset + Date.stubs(:current).returns(Date.new(2000, 1, 1)) + assert_equal false, DateTime.civil(1999,12,31,23,59,59).today? + assert_equal true, DateTime.civil(2000,1,1,0).today? + assert_equal true, DateTime.civil(2000,1,1,23,59,59).today? + assert_equal false, DateTime.civil(2000,1,2,0).today? + end + + def test_past_with_offset + DateTime.stubs(:current).returns(DateTime.civil(2005,2,10,15,30,45, Rational(-18000, 86400))) + assert_equal true, DateTime.civil(2005,2,10,15,30,44, Rational(-18000, 86400)).past? + assert_equal false, DateTime.civil(2005,2,10,15,30,45, Rational(-18000, 86400)).past? + assert_equal false, DateTime.civil(2005,2,10,15,30,46, Rational(-18000, 86400)).past? end - uses_mocha 'TestDateTimeCurrent' do - def test_current_returns_date_today_when_zone_default_not_set - with_env_tz 'US/Eastern' do - Time.stubs(:now).returns Time.local(1999, 12, 31, 23, 59, 59) - assert_equal DateTime.new(1999, 12, 31, 23, 59, 59, Rational(-18000, 86400)), DateTime.current - end + def test_past_without_offset + DateTime.stubs(:current).returns(DateTime.civil(2005,2,10,15,30,45, Rational(-18000, 86400))) + assert_equal true, DateTime.civil(2005,2,10,20,30,44).past? + assert_equal false, DateTime.civil(2005,2,10,20,30,45).past? + assert_equal false, DateTime.civil(2005,2,10,20,30,46).past? + end + + def test_future_with_offset + DateTime.stubs(:current).returns(DateTime.civil(2005,2,10,15,30,45, Rational(-18000, 86400))) + assert_equal false, DateTime.civil(2005,2,10,15,30,44, Rational(-18000, 86400)).future? + assert_equal false, DateTime.civil(2005,2,10,15,30,45, Rational(-18000, 86400)).future? + assert_equal true, DateTime.civil(2005,2,10,15,30,46, Rational(-18000, 86400)).future? + end + + def test_future_without_offset + DateTime.stubs(:current).returns(DateTime.civil(2005,2,10,15,30,45, Rational(-18000, 86400))) + assert_equal false, DateTime.civil(2005,2,10,20,30,44).future? + assert_equal false, DateTime.civil(2005,2,10,20,30,45).future? + assert_equal true, DateTime.civil(2005,2,10,20,30,46).future? + end + + def test_current_returns_date_today_when_zone_default_not_set + with_env_tz 'US/Eastern' do + Time.stubs(:now).returns Time.local(1999, 12, 31, 23, 59, 59) + assert_equal DateTime.new(1999, 12, 31, 23, 59, 59, Rational(-18000, 86400)), DateTime.current end + end - def test_current_returns_time_zone_today_when_zone_default_set - Time.zone_default = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] - with_env_tz 'US/Eastern' do - Time.stubs(:now).returns Time.local(1999, 12, 31, 23, 59, 59) - assert_equal DateTime.new(1999, 12, 31, 23, 59, 59, Rational(-18000, 86400)), DateTime.current - end - ensure - Time.zone_default = nil + def test_current_returns_time_zone_today_when_zone_default_set + Time.zone_default = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] + with_env_tz 'US/Eastern' do + Time.stubs(:now).returns Time.local(1999, 12, 31, 23, 59, 59) + assert_equal DateTime.new(1999, 12, 31, 23, 59, 59, Rational(-18000, 86400)), DateTime.current end + ensure + Time.zone_default = nil end def test_current_without_time_zone diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index 5cd52d8d79..3948006b42 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -1,6 +1,6 @@ require 'abstract_unit' -class DurationTest < Test::Unit::TestCase +class DurationTest < ActiveSupport::TestCase def test_inspect assert_equal '1 month', 1.month.inspect assert_equal '1 month and 1 day', (1.month + 1.day).inspect @@ -40,78 +40,76 @@ class DurationTest < Test::Unit::TestCase assert_equal 86400 * 1.7, 1.7.days end - uses_mocha 'TestDurationSinceAndAgoWithCurrentTime' do - def test_since_and_ago_with_fractional_days - Time.stubs(:now).returns Time.local(2000) - # since - assert_equal 36.hours.since, 1.5.days.since - assert_equal((24 * 1.7).hours.since, 1.7.days.since) - # ago - assert_equal 36.hours.ago, 1.5.days.ago - assert_equal((24 * 1.7).hours.ago, 1.7.days.ago) - end + def test_since_and_ago_with_fractional_days + Time.stubs(:now).returns Time.local(2000) + # since + assert_equal 36.hours.since, 1.5.days.since + assert_equal((24 * 1.7).hours.since, 1.7.days.since) + # ago + assert_equal 36.hours.ago, 1.5.days.ago + assert_equal((24 * 1.7).hours.ago, 1.7.days.ago) + end + + def test_since_and_ago_with_fractional_weeks + Time.stubs(:now).returns Time.local(2000) + # since + assert_equal((7 * 36).hours.since, 1.5.weeks.since) + assert_equal((7 * 24 * 1.7).hours.since, 1.7.weeks.since) + # ago + assert_equal((7 * 36).hours.ago, 1.5.weeks.ago) + assert_equal((7 * 24 * 1.7).hours.ago, 1.7.weeks.ago) + end + + def test_deprecated_fractional_years + years_re = /Fractional years are not respected\. Convert value to integer before calling #years\./ + assert_deprecated(years_re){1.0.years} + assert_deprecated(years_re){1.5.years} + assert_not_deprecated{1.years} + assert_deprecated(years_re){1.0.year} + assert_deprecated(years_re){1.5.year} + assert_not_deprecated{1.year} + end - def test_since_and_ago_with_fractional_weeks + def test_deprecated_fractional_months + months_re = /Fractional months are not respected\. Convert value to integer before calling #months\./ + assert_deprecated(months_re){1.5.months} + assert_deprecated(months_re){1.0.months} + assert_not_deprecated{1.months} + assert_deprecated(months_re){1.5.month} + assert_deprecated(months_re){1.0.month} + assert_not_deprecated{1.month} + end + + def test_since_and_ago_anchored_to_time_now_when_time_zone_default_not_set + Time.zone_default = nil + with_env_tz 'US/Eastern' do Time.stubs(:now).returns Time.local(2000) # since - assert_equal((7 * 36).hours.since, 1.5.weeks.since) - assert_equal((7 * 24 * 1.7).hours.since, 1.7.weeks.since) + assert_equal false, 5.seconds.since.is_a?(ActiveSupport::TimeWithZone) + assert_equal Time.local(2000,1,1,0,0,5), 5.seconds.since # ago - assert_equal((7 * 36).hours.ago, 1.5.weeks.ago) - assert_equal((7 * 24 * 1.7).hours.ago, 1.7.weeks.ago) - end - - def test_deprecated_fractional_years - years_re = /Fractional years are not respected\. Convert value to integer before calling #years\./ - assert_deprecated(years_re){1.0.years} - assert_deprecated(years_re){1.5.years} - assert_not_deprecated{1.years} - assert_deprecated(years_re){1.0.year} - assert_deprecated(years_re){1.5.year} - assert_not_deprecated{1.year} - end - - def test_deprecated_fractional_months - months_re = /Fractional months are not respected\. Convert value to integer before calling #months\./ - assert_deprecated(months_re){1.5.months} - assert_deprecated(months_re){1.0.months} - assert_not_deprecated{1.months} - assert_deprecated(months_re){1.5.month} - assert_deprecated(months_re){1.0.month} - assert_not_deprecated{1.month} + assert_equal false, 5.seconds.ago.is_a?(ActiveSupport::TimeWithZone) + assert_equal Time.local(1999,12,31,23,59,55), 5.seconds.ago end + end - def test_since_and_ago_anchored_to_time_now_when_time_zone_default_not_set - Time.zone_default = nil + def test_since_and_ago_anchored_to_time_zone_now_when_time_zone_default_set + silence_warnings do # silence warnings raised by tzinfo gem + Time.zone_default = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] with_env_tz 'US/Eastern' do Time.stubs(:now).returns Time.local(2000) # since - assert_equal false, 5.seconds.since.is_a?(ActiveSupport::TimeWithZone) - assert_equal Time.local(2000,1,1,0,0,5), 5.seconds.since + assert_equal true, 5.seconds.since.is_a?(ActiveSupport::TimeWithZone) + assert_equal Time.utc(2000,1,1,0,0,5), 5.seconds.since.time + assert_equal 'Eastern Time (US & Canada)', 5.seconds.since.time_zone.name # ago - assert_equal false, 5.seconds.ago.is_a?(ActiveSupport::TimeWithZone) - assert_equal Time.local(1999,12,31,23,59,55), 5.seconds.ago + assert_equal true, 5.seconds.ago.is_a?(ActiveSupport::TimeWithZone) + assert_equal Time.utc(1999,12,31,23,59,55), 5.seconds.ago.time + assert_equal 'Eastern Time (US & Canada)', 5.seconds.ago.time_zone.name end end - - def test_since_and_ago_anchored_to_time_zone_now_when_time_zone_default_set - silence_warnings do # silence warnings raised by tzinfo gem - Time.zone_default = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] - with_env_tz 'US/Eastern' do - Time.stubs(:now).returns Time.local(2000) - # since - assert_equal true, 5.seconds.since.is_a?(ActiveSupport::TimeWithZone) - assert_equal Time.utc(2000,1,1,0,0,5), 5.seconds.since.time - assert_equal 'Eastern Time (US & Canada)', 5.seconds.since.time_zone.name - # ago - assert_equal true, 5.seconds.ago.is_a?(ActiveSupport::TimeWithZone) - assert_equal Time.utc(1999,12,31,23,59,55), 5.seconds.ago.time - assert_equal 'Eastern Time (US & Canada)', 5.seconds.ago.time_zone.name - end - end - ensure - Time.zone_default = nil - end + ensure + Time.zone_default = nil end protected diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index deb9b7544d..92db977a77 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -79,4 +79,15 @@ class EnumerableTests < Test::Unit::TestCase assert ![ 1, 2 ].many? {|x| x > 1 } assert [ 1, 2, 2 ].many? {|x| x > 1 } end + + def test_none + assert [].none? + assert [nil, false].none? + assert ![1].none? + + assert [].none? {|x| x > 1 } + assert ![ 2 ].none? {|x| x > 1 } + assert ![ 1, 2 ].none? {|x| x > 1 } + assert [ 1, 1 ].none? {|x| x > 1 } + end end diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 9537f486cb..30cbba26b0 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -1,4 +1,5 @@ require 'abstract_unit' +require 'builder' class HashExtTest < Test::Unit::TestCase def setup @@ -358,12 +359,10 @@ class HashExtTest < Test::Unit::TestCase assert_nothing_raised { original.except(:a) } end - uses_mocha 'except with expectation' do - def test_except_with_mocha_expectation_on_original - original = { :a => 'x', :b => 'y' } - original.expects(:delete).never - original.except(:a) - end + def test_except_with_mocha_expectation_on_original + original = { :a => 'x', :b => 'y' } + original.expects(:delete).never + original.except(:a) end end diff --git a/activesupport/test/core_ext/module/model_naming_test.rb b/activesupport/test/core_ext/module/model_naming_test.rb index fc73fa5c36..d08349dd97 100644 --- a/activesupport/test/core_ext/module/model_naming_test.rb +++ b/activesupport/test/core_ext/module/model_naming_test.rb @@ -2,18 +2,18 @@ require 'abstract_unit' class ModelNamingTest < Test::Unit::TestCase def setup - @name = ActiveSupport::ModelName.new('Post::TrackBack') + @model_name = ActiveSupport::ModelName.new('Post::TrackBack') end def test_singular - assert_equal 'post_track_back', @name.singular + assert_equal 'post_track_back', @model_name.singular end def test_plural - assert_equal 'post_track_backs', @name.plural + assert_equal 'post_track_backs', @model_name.plural end def test_partial_path - assert_equal 'post/track_backs/track_back', @name.partial_path + assert_equal 'post/track_backs/track_back', @model_name.partial_path end end diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index 7fe5d0faee..886f692499 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -106,6 +106,17 @@ class ModuleTest < Test::Unit::TestCase assert_equal invoice.customer_city, "Chicago" end + def test_delegation_prefix_with_instance_variable + assert_raise ArgumentError do + Class.new do + def initialize(client) + @client = client + end + delegate :name, :address, :to => :@client, :prefix => true + end + end + end + def test_parent assert_equal Yz::Zy, Yz::Zy::Cd.parent assert_equal Yz, Yz::Zy.parent diff --git a/activesupport/test/core_ext/object_and_class_ext_test.rb b/activesupport/test/core_ext/object_and_class_ext_test.rb index e88dcb52d5..2f79b6f67f 100644 --- a/activesupport/test/core_ext/object_and_class_ext_test.rb +++ b/activesupport/test/core_ext/object_and_class_ext_test.rb @@ -247,3 +247,35 @@ class ObjectInstanceVariableTest < Test::Unit::TestCase [arg] + instance_exec('bar') { |v| [reverse, v] } } end end + +class ObjectTryTest < Test::Unit::TestCase + def setup + @string = "Hello" + end + + def test_nonexisting_method + method = :undefined_method + assert !@string.respond_to?(method) + assert_nil @string.try(method) + end + + def test_valid_method + assert_equal 5, @string.try(:size) + end + + def test_valid_private_method + class << @string + private :size + end + + assert_equal 5, @string.try(:size) + end + + def test_argument_forwarding + assert_equal 'Hey', @string.try(:sub, 'llo', 'y') + end + + def test_block_forwarding + assert_equal 'Hey', @string.try(:sub, 'llo') { |match| 'y' } + end +end diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index b086c957fe..e232bf8384 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -207,7 +207,7 @@ class StringBehaviourTest < Test::Unit::TestCase end end -class CoreExtStringMultibyteTest < Test::Unit::TestCase +class CoreExtStringMultibyteTest < ActiveSupport::TestCase UNICODE_STRING = 'こにちわ' ASCII_STRING = 'ohayo' BYTE_STRING = "\270\236\010\210\245" @@ -253,4 +253,4 @@ class CoreExtStringMultibyteTest < Test::Unit::TestCase assert UNICODE_STRING.mb_chars.kind_of?(String) end end -end
\ No newline at end of file +end diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index fd17f7a812..52d6c18dce 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -515,16 +515,14 @@ class TimeExtCalculationsTest < Test::Unit::TestCase assert_equal 31, Time.days_in_month(12, 2005) end - uses_mocha 'TestTimeDaysInMonthWithoutYearArg' do - def test_days_in_month_feb_in_common_year_without_year_arg - Time.stubs(:now).returns(Time.utc(2007)) - assert_equal 28, Time.days_in_month(2) - end + def test_days_in_month_feb_in_common_year_without_year_arg + Time.stubs(:now).returns(Time.utc(2007)) + assert_equal 28, Time.days_in_month(2) + end - def test_days_in_month_feb_in_leap_year_without_year_arg - Time.stubs(:now).returns(Time.utc(2008)) - assert_equal 29, Time.days_in_month(2) - end + def test_days_in_month_feb_in_leap_year_without_year_arg + Time.stubs(:now).returns(Time.utc(2008)) + assert_equal 29, Time.days_in_month(2) end def test_time_with_datetime_fallback @@ -572,71 +570,69 @@ class TimeExtCalculationsTest < Test::Unit::TestCase assert_nothing_raised { Time.now.xmlschema } end - uses_mocha 'Test Time past?, today? and future?' do - def test_today_with_time_local - Date.stubs(:current).returns(Date.new(2000, 1, 1)) - assert_equal false, Time.local(1999,12,31,23,59,59).today? - assert_equal true, Time.local(2000,1,1,0).today? - assert_equal true, Time.local(2000,1,1,23,59,59).today? - assert_equal false, Time.local(2000,1,2,0).today? - end - - def test_today_with_time_utc - Date.stubs(:current).returns(Date.new(2000, 1, 1)) - assert_equal false, Time.utc(1999,12,31,23,59,59).today? - assert_equal true, Time.utc(2000,1,1,0).today? - assert_equal true, Time.utc(2000,1,1,23,59,59).today? - assert_equal false, Time.utc(2000,1,2,0).today? - end - - def test_past_with_time_current_as_time_local - with_env_tz 'US/Eastern' do - Time.stubs(:current).returns(Time.local(2005,2,10,15,30,45)) - assert_equal true, Time.local(2005,2,10,15,30,44).past? - assert_equal false, Time.local(2005,2,10,15,30,45).past? - assert_equal false, Time.local(2005,2,10,15,30,46).past? - assert_equal true, Time.utc(2005,2,10,20,30,44).past? - assert_equal false, Time.utc(2005,2,10,20,30,45).past? - assert_equal false, Time.utc(2005,2,10,20,30,46).past? - end - end - - def test_past_with_time_current_as_time_with_zone - with_env_tz 'US/Eastern' do - twz = Time.utc(2005,2,10,15,30,45).in_time_zone('Central Time (US & Canada)') - Time.stubs(:current).returns(twz) - assert_equal true, Time.local(2005,2,10,10,30,44).past? - assert_equal false, Time.local(2005,2,10,10,30,45).past? - assert_equal false, Time.local(2005,2,10,10,30,46).past? - assert_equal true, Time.utc(2005,2,10,15,30,44).past? - assert_equal false, Time.utc(2005,2,10,15,30,45).past? - assert_equal false, Time.utc(2005,2,10,15,30,46).past? - end - end - - def test_future_with_time_current_as_time_local - with_env_tz 'US/Eastern' do - Time.stubs(:current).returns(Time.local(2005,2,10,15,30,45)) - assert_equal false, Time.local(2005,2,10,15,30,44).future? - assert_equal false, Time.local(2005,2,10,15,30,45).future? - assert_equal true, Time.local(2005,2,10,15,30,46).future? - assert_equal false, Time.utc(2005,2,10,20,30,44).future? - assert_equal false, Time.utc(2005,2,10,20,30,45).future? - assert_equal true, Time.utc(2005,2,10,20,30,46).future? - end - end - - def test_future_with_time_current_as_time_with_zone - with_env_tz 'US/Eastern' do - twz = Time.utc(2005,2,10,15,30,45).in_time_zone('Central Time (US & Canada)') - Time.stubs(:current).returns(twz) - assert_equal false, Time.local(2005,2,10,10,30,44).future? - assert_equal false, Time.local(2005,2,10,10,30,45).future? - assert_equal true, Time.local(2005,2,10,10,30,46).future? - assert_equal false, Time.utc(2005,2,10,15,30,44).future? - assert_equal false, Time.utc(2005,2,10,15,30,45).future? - assert_equal true, Time.utc(2005,2,10,15,30,46).future? - end + def test_today_with_time_local + Date.stubs(:current).returns(Date.new(2000, 1, 1)) + assert_equal false, Time.local(1999,12,31,23,59,59).today? + assert_equal true, Time.local(2000,1,1,0).today? + assert_equal true, Time.local(2000,1,1,23,59,59).today? + assert_equal false, Time.local(2000,1,2,0).today? + end + + def test_today_with_time_utc + Date.stubs(:current).returns(Date.new(2000, 1, 1)) + assert_equal false, Time.utc(1999,12,31,23,59,59).today? + assert_equal true, Time.utc(2000,1,1,0).today? + assert_equal true, Time.utc(2000,1,1,23,59,59).today? + assert_equal false, Time.utc(2000,1,2,0).today? + end + + def test_past_with_time_current_as_time_local + with_env_tz 'US/Eastern' do + Time.stubs(:current).returns(Time.local(2005,2,10,15,30,45)) + assert_equal true, Time.local(2005,2,10,15,30,44).past? + assert_equal false, Time.local(2005,2,10,15,30,45).past? + assert_equal false, Time.local(2005,2,10,15,30,46).past? + assert_equal true, Time.utc(2005,2,10,20,30,44).past? + assert_equal false, Time.utc(2005,2,10,20,30,45).past? + assert_equal false, Time.utc(2005,2,10,20,30,46).past? + end + end + + def test_past_with_time_current_as_time_with_zone + with_env_tz 'US/Eastern' do + twz = Time.utc(2005,2,10,15,30,45).in_time_zone('Central Time (US & Canada)') + Time.stubs(:current).returns(twz) + assert_equal true, Time.local(2005,2,10,10,30,44).past? + assert_equal false, Time.local(2005,2,10,10,30,45).past? + assert_equal false, Time.local(2005,2,10,10,30,46).past? + assert_equal true, Time.utc(2005,2,10,15,30,44).past? + assert_equal false, Time.utc(2005,2,10,15,30,45).past? + assert_equal false, Time.utc(2005,2,10,15,30,46).past? + end + end + + def test_future_with_time_current_as_time_local + with_env_tz 'US/Eastern' do + Time.stubs(:current).returns(Time.local(2005,2,10,15,30,45)) + assert_equal false, Time.local(2005,2,10,15,30,44).future? + assert_equal false, Time.local(2005,2,10,15,30,45).future? + assert_equal true, Time.local(2005,2,10,15,30,46).future? + assert_equal false, Time.utc(2005,2,10,20,30,44).future? + assert_equal false, Time.utc(2005,2,10,20,30,45).future? + assert_equal true, Time.utc(2005,2,10,20,30,46).future? + end + end + + def test_future_with_time_current_as_time_with_zone + with_env_tz 'US/Eastern' do + twz = Time.utc(2005,2,10,15,30,45).in_time_zone('Central Time (US & Canada)') + Time.stubs(:current).returns(twz) + assert_equal false, Time.local(2005,2,10,10,30,44).future? + assert_equal false, Time.local(2005,2,10,10,30,45).future? + assert_equal true, Time.local(2005,2,10,10,30,46).future? + assert_equal false, Time.utc(2005,2,10,15,30,44).future? + assert_equal false, Time.utc(2005,2,10,15,30,45).future? + assert_equal true, Time.utc(2005,2,10,15,30,46).future? end end diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index 774fd57ee6..dc36336239 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -152,50 +152,48 @@ class TimeWithZoneTest < Test::Unit::TestCase assert_equal false, @twz.between?(Time.utc(2000,1,1,0,0,1), Time.utc(2000,1,1,0,0,2)) end - uses_mocha 'TimeWithZone past?, today? and future?' do - def test_today - Date.stubs(:current).returns(Date.new(2000, 1, 1)) - assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.utc(1999,12,31,23,59,59) ).today? - assert_equal true, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.utc(2000,1,1,0) ).today? - assert_equal true, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.utc(2000,1,1,23,59,59) ).today? - assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.utc(2000,1,2,0) ).today? - end - - def test_past_with_time_current_as_time_local - with_env_tz 'US/Eastern' do - Time.stubs(:current).returns(Time.local(2005,2,10,15,30,45)) - assert_equal true, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,44)).past? - assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,45)).past? - assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,46)).past? - end - end - - def test_past_with_time_current_as_time_with_zone - twz = ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,45) ) - Time.stubs(:current).returns(twz) + def test_today + Date.stubs(:current).returns(Date.new(2000, 1, 1)) + assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.utc(1999,12,31,23,59,59) ).today? + assert_equal true, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.utc(2000,1,1,0) ).today? + assert_equal true, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.utc(2000,1,1,23,59,59) ).today? + assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.utc(2000,1,2,0) ).today? + end + + def test_past_with_time_current_as_time_local + with_env_tz 'US/Eastern' do + Time.stubs(:current).returns(Time.local(2005,2,10,15,30,45)) assert_equal true, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,44)).past? assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,45)).past? assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,46)).past? end - - def test_future_with_time_current_as_time_local - with_env_tz 'US/Eastern' do - Time.stubs(:current).returns(Time.local(2005,2,10,15,30,45)) - assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,44)).future? - assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,45)).future? - assert_equal true, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,46)).future? - end - end - - def future_with_time_current_as_time_with_zone - twz = ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,45) ) - Time.stubs(:current).returns(twz) + end + + def test_past_with_time_current_as_time_with_zone + twz = ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,45) ) + Time.stubs(:current).returns(twz) + assert_equal true, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,44)).past? + assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,45)).past? + assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,46)).past? + end + + def test_future_with_time_current_as_time_local + with_env_tz 'US/Eastern' do + Time.stubs(:current).returns(Time.local(2005,2,10,15,30,45)) assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,44)).future? assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,45)).future? assert_equal true, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,46)).future? end end + def future_with_time_current_as_time_with_zone + twz = ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,45) ) + Time.stubs(:current).returns(twz) + assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,44)).future? + assert_equal false, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,45)).future? + assert_equal true, ActiveSupport::TimeWithZone.new( nil, @time_zone, Time.local(2005,2,10,15,30,46)).future? + end + def test_eql? assert @twz.eql?(Time.utc(2000)) assert @twz.eql?( ActiveSupport::TimeWithZone.new(Time.utc(2000), ActiveSupport::TimeZone["Hawaii"]) ) @@ -399,28 +397,26 @@ class TimeWithZoneTest < Test::Unit::TestCase end end - uses_mocha 'TestDatePartValueMethods' do - def test_method_missing_with_non_time_return_value - silence_warnings do # silence warnings raised by tzinfo gem - @twz.time.expects(:foo).returns('bar') - assert_equal 'bar', @twz.foo - end + def test_method_missing_with_non_time_return_value + silence_warnings do # silence warnings raised by tzinfo gem + @twz.time.expects(:foo).returns('bar') + assert_equal 'bar', @twz.foo end + end - def test_date_part_value_methods - silence_warnings do # silence warnings raised by tzinfo gem - twz = ActiveSupport::TimeWithZone.new(Time.utc(1999,12,31,19,18,17,500), @time_zone) - twz.expects(:method_missing).never - assert_equal 1999, twz.year - assert_equal 12, twz.month - assert_equal 31, twz.day - assert_equal 14, twz.hour - assert_equal 18, twz.min - assert_equal 17, twz.sec - assert_equal 500, twz.usec - assert_equal 5, twz.wday - assert_equal 365, twz.yday - end + def test_date_part_value_methods + silence_warnings do # silence warnings raised by tzinfo gem + twz = ActiveSupport::TimeWithZone.new(Time.utc(1999,12,31,19,18,17,500), @time_zone) + twz.expects(:method_missing).never + assert_equal 1999, twz.year + assert_equal 12, twz.month + assert_equal 31, twz.day + assert_equal 14, twz.hour + assert_equal 18, twz.min + assert_equal 17, twz.sec + assert_equal 500, twz.usec + assert_equal 5, twz.wday + assert_equal 365, twz.yday end end @@ -885,28 +881,26 @@ class TimeWithZoneMethodsForTimeAndDateTimeTest < Test::Unit::TestCase assert_equal nil, Time.zone end - uses_mocha 'TestTimeCurrent' do - def test_current_returns_time_now_when_zone_default_not_set - with_env_tz 'US/Eastern' do - Time.stubs(:now).returns Time.local(2000) - assert_equal false, Time.current.is_a?(ActiveSupport::TimeWithZone) - assert_equal Time.local(2000), Time.current - end + def test_current_returns_time_now_when_zone_default_not_set + with_env_tz 'US/Eastern' do + Time.stubs(:now).returns Time.local(2000) + assert_equal false, Time.current.is_a?(ActiveSupport::TimeWithZone) + assert_equal Time.local(2000), Time.current end + end - def test_current_returns_time_zone_now_when_zone_default_set - silence_warnings do # silence warnings raised by tzinfo gem - Time.zone_default = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] - with_env_tz 'US/Eastern' do - Time.stubs(:now).returns Time.local(2000) - assert_equal true, Time.current.is_a?(ActiveSupport::TimeWithZone) - assert_equal 'Eastern Time (US & Canada)', Time.current.time_zone.name - assert_equal Time.utc(2000), Time.current.time - end + def test_current_returns_time_zone_now_when_zone_default_set + silence_warnings do # silence warnings raised by tzinfo gem + Time.zone_default = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] + with_env_tz 'US/Eastern' do + Time.stubs(:now).returns Time.local(2000) + assert_equal true, Time.current.is_a?(ActiveSupport::TimeWithZone) + assert_equal 'Eastern Time (US & Canada)', Time.current.time_zone.name + assert_equal Time.utc(2000), Time.current.time end - ensure - Time.zone_default = nil end + ensure + Time.zone_default = nil end protected diff --git a/activesupport/test/deprecation_test.rb b/activesupport/test/deprecation_test.rb index 27e9573ce2..73a1f9959c 100644 --- a/activesupport/test/deprecation_test.rb +++ b/activesupport/test/deprecation_test.rb @@ -32,7 +32,7 @@ class Deprecatee end -class DeprecationTest < Test::Unit::TestCase +class DeprecationTest < ActiveSupport::TestCase def setup # Track the last warning. @old_behavior = ActiveSupport::Deprecation.behavior @@ -143,19 +143,21 @@ class DeprecationTest < Test::Unit::TestCase assert_deprecated(/you now need to do something extra for this one/) { @dtc.d } end - def test_assertion_failed_error_doesnt_spout_deprecation_warnings - error_class = Class.new(StandardError) do - def message - ActiveSupport::Deprecation.warn 'warning in error message' - super + unless defined?(::MiniTest) + def test_assertion_failed_error_doesnt_spout_deprecation_warnings + error_class = Class.new(StandardError) do + def message + ActiveSupport::Deprecation.warn 'warning in error message' + super + end end - end - raise error_class.new('hmm') + raise error_class.new('hmm') - rescue => e - error = Test::Unit::Error.new('testing ur doodz', e) - assert_not_deprecated { error.message } - assert_nil @last_message + rescue => e + error = Test::Unit::Error.new('testing ur doodz', e) + assert_not_deprecated { error.message } + assert_nil @last_message + end end end diff --git a/activesupport/test/i18n_test.rb b/activesupport/test/i18n_test.rb index db5bd5e088..cfb8c76d52 100644 --- a/activesupport/test/i18n_test.rb +++ b/activesupport/test/i18n_test.rb @@ -6,11 +6,9 @@ class I18nTest < Test::Unit::TestCase @time = Time.utc(2008, 7, 2, 16, 47, 1) end - uses_mocha 'I18nTimeZoneTest' do - def test_time_zone_localization_with_default_format - Time.zone.stubs(:now).returns Time.local(2000) - assert_equal Time.zone.now.strftime("%a, %d %b %Y %H:%M:%S %z"), I18n.localize(Time.zone.now) - end + def test_time_zone_localization_with_default_format + Time.zone.stubs(:now).returns Time.local(2000) + assert_equal Time.zone.now.strftime("%a, %d %b %Y %H:%M:%S %z"), I18n.localize(Time.zone.now) end def test_date_localization_should_use_default_format @@ -83,9 +81,9 @@ class I18nTest < Test::Unit::TestCase def test_to_sentence assert_equal 'a, b, and c', %w[a b c].to_sentence - I18n.backend.store_translations 'en-US', :support => { :array => { :skip_last_comma => true } } + I18n.backend.store_translations 'en', :support => { :array => { :skip_last_comma => true } } assert_equal 'a, b and c', %w[a b c].to_sentence ensure - I18n.backend.store_translations 'en-US', :support => { :array => { :skip_last_comma => false } } + I18n.backend.store_translations 'en', :support => { :array => { :skip_last_comma => false } } end end diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index d30852c013..d8c93dc9ae 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -104,6 +104,12 @@ class InflectorTest < Test::Unit::TestCase end end + def test_parameterize_and_normalize + StringToParameterizedAndNormalized.each do |some_string, parameterized_string| + assert_equal(parameterized_string, ActiveSupport::Inflector.parameterize(some_string)) + end + end + def test_parameterize_with_custom_separator StringToParameterized.each do |some_string, parameterized_string| assert_equal(parameterized_string.gsub('-', '_'), ActiveSupport::Inflector.parameterize(some_string, '_')) diff --git a/activesupport/test/inflector_test_cases.rb b/activesupport/test/inflector_test_cases.rb index 3aa18ca781..481c3e835c 100644 --- a/activesupport/test/inflector_test_cases.rb +++ b/activesupport/test/inflector_test_cases.rb @@ -147,14 +147,25 @@ module InflectorTestCases StringToParameterized = { "Donald E. Knuth" => "donald-e-knuth", "Random text with *(bad)* characters" => "random-text-with-bad-characters", - "Malmö" => "malmo", - "Garçons" => "garcons", "Allow_Under_Scores" => "allow_under_scores", "Trailing bad characters!@#" => "trailing-bad-characters", "!@#Leading bad characters" => "leading-bad-characters", "Squeeze separators" => "squeeze-separators" } + # Ruby 1.9 doesn't do Unicode normalization yet. + if RUBY_VERSION >= '1.9' + StringToParameterizedAndNormalized = { + "Malmö" => "malm", + "Garçons" => "gar-ons" + } + else + StringToParameterizedAndNormalized = { + "Malmö" => "malmo", + "Garçons" => "garcons" + } + end + UnderscoreToHuman = { "employee_salary" => "Employee salary", "employee_id" => "Employee", diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb index c070e0d9ed..8ed21cc9ad 100644 --- a/activesupport/test/json/encoding_test.rb +++ b/activesupport/test/json/encoding_test.rb @@ -126,15 +126,13 @@ class TestJSONEncoding < Test::Unit::TestCase end end -uses_mocha 'JsonOptionsTests' do - class JsonOptionsTests < Test::Unit::TestCase - def test_enumerable_should_passthrough_options_to_elements - json_options = { :include => :posts } - ActiveSupport::JSON.expects(:encode).with(1, json_options) - ActiveSupport::JSON.expects(:encode).with(2, json_options) - ActiveSupport::JSON.expects(:encode).with('foo', json_options) - - [1, 2, 'foo'].to_json(json_options) - end +class JsonOptionsTests < Test::Unit::TestCase + def test_enumerable_should_passthrough_options_to_elements + json_options = { :include => :posts } + ActiveSupport::JSON.expects(:encode).with(1, json_options) + ActiveSupport::JSON.expects(:encode).with(2, json_options) + ActiveSupport::JSON.expects(:encode).with('foo', json_options) + + [1, 2, 'foo'].to_json(json_options) end end diff --git a/activesupport/test/memoizable_test.rb b/activesupport/test/memoizable_test.rb index a78ebd9425..069ae27eb2 100644 --- a/activesupport/test/memoizable_test.rb +++ b/activesupport/test/memoizable_test.rb @@ -1,218 +1,226 @@ require 'abstract_unit' -uses_mocha 'Memoizable' do - class MemoizableTest < Test::Unit::TestCase - class Person - extend ActiveSupport::Memoizable - - attr_reader :name_calls, :age_calls - def initialize - @name_calls = 0 - @age_calls = 0 - end +class MemoizableTest < Test::Unit::TestCase + class Person + extend ActiveSupport::Memoizable - def name - @name_calls += 1 - "Josh" - end + attr_reader :name_calls, :age_calls + def initialize + @name_calls = 0 + @age_calls = 0 + end - def name? - true - end - memoize :name? + def name + @name_calls += 1 + "Josh" + end - def update(name) - "Joshua" - end - memoize :update + def name? + true + end + memoize :name? - def age - @age_calls += 1 - nil - end + def update(name) + "Joshua" + end + memoize :update - memoize :name, :age + def age + @age_calls += 1 + nil end - class Company - attr_reader :name_calls - def initialize - @name_calls = 0 - end + memoize :name, :age + end - def name - @name_calls += 1 - "37signals" - end + class Company + attr_reader :name_calls + def initialize + @name_calls = 0 end - module Rates - extend ActiveSupport::Memoizable - - attr_reader :sales_tax_calls - def sales_tax(price) - @sales_tax_calls ||= 0 - @sales_tax_calls += 1 - price * 0.1025 - end - memoize :sales_tax + def name + @name_calls += 1 + "37signals" end + end - class Calculator - extend ActiveSupport::Memoizable - include Rates + module Rates + extend ActiveSupport::Memoizable - attr_reader :fib_calls - def initialize - @fib_calls = 0 - end + attr_reader :sales_tax_calls + def sales_tax(price) + @sales_tax_calls ||= 0 + @sales_tax_calls += 1 + price * 0.1025 + end + memoize :sales_tax + end - def fib(n) - @fib_calls += 1 + class Calculator + extend ActiveSupport::Memoizable + include Rates - if n == 0 || n == 1 - n - else - fib(n - 1) + fib(n - 2) - end - end - memoize :fib + attr_reader :fib_calls + def initialize + @fib_calls = 0 + end - def counter - @count ||= 0 - @count += 1 + def fib(n) + @fib_calls += 1 + + if n == 0 || n == 1 + n + else + fib(n - 1) + fib(n - 2) end - memoize :counter end + memoize :fib - def setup - @person = Person.new - @calculator = Calculator.new + def counter + @count ||= 0 + @count += 1 end + memoize :counter + end - def test_memoization - assert_equal "Josh", @person.name - assert_equal 1, @person.name_calls - - 3.times { assert_equal "Josh", @person.name } - assert_equal 1, @person.name_calls - end + def setup + @person = Person.new + @calculator = Calculator.new + end - def test_memoization_with_punctuation - assert_equal true, @person.name? + def test_memoization + assert_equal "Josh", @person.name + assert_equal 1, @person.name_calls - assert_nothing_raised(NameError) do - @person.memoize_all - @person.unmemoize_all - end - end + 3.times { assert_equal "Josh", @person.name } + assert_equal 1, @person.name_calls + end - def test_memoization_with_nil_value - assert_equal nil, @person.age - assert_equal 1, @person.age_calls + def test_memoization_with_punctuation + assert_equal true, @person.name? - 3.times { assert_equal nil, @person.age } - assert_equal 1, @person.age_calls + assert_nothing_raised(NameError) do + @person.memoize_all + @person.unmemoize_all end + end - def test_memorized_results_are_immutable - assert_equal "Josh", @person.name - assert_raise(ActiveSupport::FrozenObjectError) { @person.name.gsub!("Josh", "Gosh") } - end + def test_memoization_with_nil_value + assert_equal nil, @person.age + assert_equal 1, @person.age_calls - def test_reloadable - counter = @calculator.counter - assert_equal 1, @calculator.counter - assert_equal 2, @calculator.counter(:reload) - assert_equal 2, @calculator.counter - assert_equal 3, @calculator.counter(true) - assert_equal 3, @calculator.counter - end - - def test_unmemoize_all - assert_equal 1, @calculator.counter + 3.times { assert_equal nil, @person.age } + assert_equal 1, @person.age_calls + end - assert @calculator.instance_variable_get(:@_memoized_counter).any? - @calculator.unmemoize_all - assert @calculator.instance_variable_get(:@_memoized_counter).empty? + def test_memorized_results_are_immutable + assert_equal "Josh", @person.name + assert_raise(ActiveSupport::FrozenObjectError) { @person.name.gsub!("Josh", "Gosh") } + end - assert_equal 2, @calculator.counter - end + def test_reloadable + counter = @calculator.counter + assert_equal 1, @calculator.counter + assert_equal 2, @calculator.counter(:reload) + assert_equal 2, @calculator.counter + assert_equal 3, @calculator.counter(true) + assert_equal 3, @calculator.counter + end - def test_memoize_all - @calculator.memoize_all - assert @calculator.instance_variable_defined?(:@_memoized_counter) - end + def test_flush_cache + assert_equal 1, @calculator.counter - def test_memoization_cache_is_different_for_each_instance - assert_equal 1, @calculator.counter - assert_equal 2, @calculator.counter(:reload) - assert_equal 1, Calculator.new.counter - end + assert @calculator.instance_variable_get(:@_memoized_counter).any? + @calculator.flush_cache(:counter) + assert @calculator.instance_variable_get(:@_memoized_counter).empty? - def test_memoized_is_not_affected_by_freeze - @person.freeze - assert_equal "Josh", @person.name - assert_equal "Joshua", @person.update("Joshua") - end + assert_equal 2, @calculator.counter + end - def test_memoization_with_args - assert_equal 55, @calculator.fib(10) - assert_equal 11, @calculator.fib_calls - end + def test_unmemoize_all + assert_equal 1, @calculator.counter - def test_reloadable_with_args - assert_equal 55, @calculator.fib(10) - assert_equal 11, @calculator.fib_calls - assert_equal 55, @calculator.fib(10, :reload) - assert_equal 12, @calculator.fib_calls - assert_equal 55, @calculator.fib(10, true) - assert_equal 13, @calculator.fib_calls - end + assert @calculator.instance_variable_get(:@_memoized_counter).any? + @calculator.unmemoize_all + assert @calculator.instance_variable_get(:@_memoized_counter).empty? - def test_object_memoization - [Company.new, Company.new, Company.new].each do |company| - company.extend ActiveSupport::Memoizable - company.memoize :name + assert_equal 2, @calculator.counter + end - assert_equal "37signals", company.name - assert_equal 1, company.name_calls - assert_equal "37signals", company.name - assert_equal 1, company.name_calls - end - end + def test_memoize_all + @calculator.memoize_all + assert @calculator.instance_variable_defined?(:@_memoized_counter) + end - def test_memoized_module_methods - assert_equal 1.025, @calculator.sales_tax(10) - assert_equal 1, @calculator.sales_tax_calls - assert_equal 1.025, @calculator.sales_tax(10) - assert_equal 1, @calculator.sales_tax_calls - assert_equal 2.5625, @calculator.sales_tax(25) - assert_equal 2, @calculator.sales_tax_calls - end + def test_memoization_cache_is_different_for_each_instance + assert_equal 1, @calculator.counter + assert_equal 2, @calculator.counter(:reload) + assert_equal 1, Calculator.new.counter + end - def test_object_memoized_module_methods - company = Company.new - company.extend(Rates) + def test_memoized_is_not_affected_by_freeze + @person.freeze + assert_equal "Josh", @person.name + assert_equal "Joshua", @person.update("Joshua") + end - assert_equal 1.025, company.sales_tax(10) - assert_equal 1, company.sales_tax_calls - assert_equal 1.025, company.sales_tax(10) - assert_equal 1, company.sales_tax_calls - assert_equal 2.5625, company.sales_tax(25) - assert_equal 2, company.sales_tax_calls - end + def test_memoization_with_args + assert_equal 55, @calculator.fib(10) + assert_equal 11, @calculator.fib_calls + end - def test_double_memoization - assert_raise(RuntimeError) { Person.memoize :name } - person = Person.new - person.extend ActiveSupport::Memoizable - assert_raise(RuntimeError) { person.memoize :name } + def test_reloadable_with_args + assert_equal 55, @calculator.fib(10) + assert_equal 11, @calculator.fib_calls + assert_equal 55, @calculator.fib(10, :reload) + assert_equal 12, @calculator.fib_calls + assert_equal 55, @calculator.fib(10, true) + assert_equal 13, @calculator.fib_calls + end - company = Company.new + def test_object_memoization + [Company.new, Company.new, Company.new].each do |company| company.extend ActiveSupport::Memoizable company.memoize :name - assert_raise(RuntimeError) { company.memoize :name } + + assert_equal "37signals", company.name + assert_equal 1, company.name_calls + assert_equal "37signals", company.name + assert_equal 1, company.name_calls end end + + def test_memoized_module_methods + assert_equal 1.025, @calculator.sales_tax(10) + assert_equal 1, @calculator.sales_tax_calls + assert_equal 1.025, @calculator.sales_tax(10) + assert_equal 1, @calculator.sales_tax_calls + assert_equal 2.5625, @calculator.sales_tax(25) + assert_equal 2, @calculator.sales_tax_calls + end + + def test_object_memoized_module_methods + company = Company.new + company.extend(Rates) + + assert_equal 1.025, company.sales_tax(10) + assert_equal 1, company.sales_tax_calls + assert_equal 1.025, company.sales_tax(10) + assert_equal 1, company.sales_tax_calls + assert_equal 2.5625, company.sales_tax(25) + assert_equal 2, company.sales_tax_calls + end + + def test_double_memoization + assert_raise(RuntimeError) { Person.memoize :name } + person = Person.new + person.extend ActiveSupport::Memoizable + assert_raise(RuntimeError) { person.memoize :name } + + company = Company.new + company.extend ActiveSupport::Memoizable + company.memoize :name + assert_raise(RuntimeError) { company.memoize :name } + end end diff --git a/activesupport/test/message_encryptor_test.rb b/activesupport/test/message_encryptor_test.rb new file mode 100644 index 0000000000..c0b4a4658c --- /dev/null +++ b/activesupport/test/message_encryptor_test.rb @@ -0,0 +1,46 @@ +require 'abstract_unit' + +class MessageEncryptorTest < Test::Unit::TestCase + def setup + @encryptor = ActiveSupport::MessageEncryptor.new(ActiveSupport::SecureRandom.hex(64)) + @data = {:some=>"data", :now=>Time.now} + end + + def test_simple_round_tripping + message = @encryptor.encrypt(@data) + assert_equal @data, @encryptor.decrypt(message) + end + + def test_encrypting_twice_yields_differing_cipher_text + first_messqage = @encryptor.encrypt(@data) + second_message = @encryptor.encrypt(@data) + assert_not_equal first_messqage, second_message + end + + def test_messing_with_either_value_causes_failure + text, iv = @encryptor.encrypt(@data).split("--") + assert_not_decrypted([iv, text] * "--") + assert_not_decrypted([text, munge(iv)] * "--") + assert_not_decrypted([munge(text), iv] * "--") + assert_not_decrypted([munge(text), munge(iv)] * "--") + end + + def test_signed_round_tripping + message = @encryptor.encrypt_and_sign(@data) + assert_equal @data, @encryptor.decrypt_and_verify(message) + end + + + private + def assert_not_decrypted(value) + assert_raises(ActiveSupport::MessageEncryptor::InvalidMessage) do + @encryptor.decrypt(value) + end + end + + def munge(base64_string) + bits = ActiveSupport::Base64.decode64(base64_string) + bits.reverse! + ActiveSupport::Base64.encode64s(bits) + end +end diff --git a/activesupport/test/message_verifier_test.rb b/activesupport/test/message_verifier_test.rb new file mode 100644 index 0000000000..2190308856 --- /dev/null +++ b/activesupport/test/message_verifier_test.rb @@ -0,0 +1,25 @@ +require 'abstract_unit' + +class MessageVerifierTest < Test::Unit::TestCase + def setup + @verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!") + @data = {:some=>"data", :now=>Time.now} + end + + def test_simple_round_tripping + message = @verifier.generate(@data) + assert_equal @data, @verifier.verify(message) + end + + def test_tampered_data_raises + data, hash = @verifier.generate(@data).split("--") + assert_not_verified("#{data.reverse}--#{hash}") + assert_not_verified("#{data}--#{hash.reverse}") + end + + def assert_not_verified(message) + assert_raises(ActiveSupport::MessageVerifier::InvalidSignature) do + @verifier.verify(message) + end + end +end diff --git a/activesupport/test/multibyte_unicode_database_test.rb b/activesupport/test/multibyte_unicode_database_test.rb index fb415e08d3..405c7c2108 100644 --- a/activesupport/test/multibyte_unicode_database_test.rb +++ b/activesupport/test/multibyte_unicode_database_test.rb @@ -1,11 +1,7 @@ # encoding: utf-8 - require 'abstract_unit' -uses_mocha "MultibyteUnicodeDatabaseTest" do - class MultibyteUnicodeDatabaseTest < Test::Unit::TestCase - def setup @ucd = ActiveSupport::Multibyte::UnicodeDatabase.new end @@ -24,5 +20,3 @@ class MultibyteUnicodeDatabaseTest < Test::Unit::TestCase end end end - -end
\ No newline at end of file diff --git a/activesupport/test/option_merger_test.rb b/activesupport/test/option_merger_test.rb index 0d72314880..f26d61617d 100644 --- a/activesupport/test/option_merger_test.rb +++ b/activesupport/test/option_merger_test.rb @@ -64,6 +64,14 @@ class OptionMergerTest < Test::Unit::TestCase end end end + + def test_nested_method_with_options_using_lamdba + local_lamdba = lambda { { :lambda => true } } + with_options(@options) do |o| + assert_equal @options.merge(local_lamdba.call), + o.method_with_options(local_lamdba).call + end + end # Needed when counting objects with the ObjectSpace def test_option_merger_class_method diff --git a/activesupport/test/ordered_hash_test.rb b/activesupport/test/ordered_hash_test.rb index 98a6ad6b26..17dffbd624 100644 --- a/activesupport/test/ordered_hash_test.rb +++ b/activesupport/test/ordered_hash_test.rb @@ -61,4 +61,16 @@ class OrderedHashTest < Test::Unit::TestCase assert_equal false, @ordered_hash.has_value?('ABCABC') assert_equal false, @ordered_hash.value?('ABCABC') end + + def test_each_key + keys = [] + @ordered_hash.each_key { |k| keys << k } + assert_equal @keys, keys + end + + def test_each_value + values = [] + @ordered_hash.each_value { |v| values << v } + assert_equal @values, values + end end diff --git a/activesupport/test/test_test.rb b/activesupport/test/test_test.rb index 4e253848f6..298037e27c 100644 --- a/activesupport/test/test_test.rb +++ b/activesupport/test/test_test.rb @@ -1,7 +1,6 @@ require 'abstract_unit' -require 'active_support/test_case' -class AssertDifferenceTest < Test::Unit::TestCase +class AssertDifferenceTest < ActiveSupport::TestCase def setup @object = Class.new do attr_accessor :num @@ -66,8 +65,8 @@ class AssertDifferenceTest < Test::Unit::TestCase @object.increment end fail 'should not get to here' - rescue Test::Unit::AssertionFailedError => e - assert_equal "<1 + 1> was the expression that failed.\n<3> expected but was\n<2>.", e.message + rescue Exception => e + assert_equal "<3> expected but was\n<2>.", e.message end def test_array_of_expressions_identify_failure_when_message_provided @@ -75,8 +74,8 @@ class AssertDifferenceTest < Test::Unit::TestCase @object.increment end fail 'should not get to here' - rescue Test::Unit::AssertionFailedError => e - assert_equal "something went wrong.\n<1 + 1> was the expression that failed.\n<3> expected but was\n<2>.", e.message + rescue Exception => e + assert_equal "something went wrong.\n<3> expected but was\n<2>.", e.message end else def default_test; end @@ -84,15 +83,17 @@ class AssertDifferenceTest < Test::Unit::TestCase end # These should always pass -class NotTestingThingsTest < Test::Unit::TestCase - include ActiveSupport::Testing::Default +if ActiveSupport::Testing.const_defined?(:Default) + class NotTestingThingsTest < Test::Unit::TestCase + include ActiveSupport::Testing::Default + end end class AlsoDoingNothingTest < ActiveSupport::TestCase end # Setup and teardown callbacks. -class SetupAndTeardownTest < Test::Unit::TestCase +class SetupAndTeardownTest < ActiveSupport::TestCase setup :reset_callback_record, :foo teardown :foo, :sentinel, :foo diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb index d999b9f2a8..f80575cfd4 100644 --- a/activesupport/test/time_zone_test.rb +++ b/activesupport/test/time_zone_test.rb @@ -51,52 +51,50 @@ class TimeZoneTest < Test::Unit::TestCase define_method("test_utc_offset_for_#{name}") do silence_warnings do # silence warnings raised by tzinfo gem - period = zone.tzinfo.period_for_utc(Time.utc(2009,1,1,0,0,0)) + period = zone.tzinfo.current_period assert_equal period.utc_offset, zone.utc_offset end end end - uses_mocha 'TestTimeZoneNowAndToday' do - def test_now - with_env_tz 'US/Eastern' do - Time.stubs(:now).returns(Time.local(2000)) - zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] - assert_instance_of ActiveSupport::TimeWithZone, zone.now - assert_equal Time.utc(2000,1,1,5), zone.now.utc - assert_equal Time.utc(2000), zone.now.time - assert_equal zone, zone.now.time_zone - end + def test_now + with_env_tz 'US/Eastern' do + Time.stubs(:now).returns(Time.local(2000)) + zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] + assert_instance_of ActiveSupport::TimeWithZone, zone.now + assert_equal Time.utc(2000,1,1,5), zone.now.utc + assert_equal Time.utc(2000), zone.now.time + assert_equal zone, zone.now.time_zone end + end - def test_now_enforces_spring_dst_rules - with_env_tz 'US/Eastern' do - Time.stubs(:now).returns(Time.local(2006,4,2,2)) # 2AM springs forward to 3AM - zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] - assert_equal Time.utc(2006,4,2,3), zone.now.time - assert_equal true, zone.now.dst? - end + def test_now_enforces_spring_dst_rules + with_env_tz 'US/Eastern' do + Time.stubs(:now).returns(Time.local(2006,4,2,2)) # 2AM springs forward to 3AM + zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] + assert_equal Time.utc(2006,4,2,3), zone.now.time + assert_equal true, zone.now.dst? end + end - def test_now_enforces_fall_dst_rules - with_env_tz 'US/Eastern' do - Time.stubs(:now).returns(Time.at(1162098000)) # equivalent to 1AM DST - zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] - assert_equal Time.utc(2006,10,29,1), zone.now.time - assert_equal true, zone.now.dst? - end + def test_now_enforces_fall_dst_rules + with_env_tz 'US/Eastern' do + Time.stubs(:now).returns(Time.at(1162098000)) # equivalent to 1AM DST + zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] + assert_equal Time.utc(2006,10,29,1), zone.now.time + assert_equal true, zone.now.dst? end + end - def test_today - Time.stubs(:now).returns(Time.utc(2000, 1, 1, 4, 59, 59)) # 1 sec before midnight Jan 1 EST - assert_equal Date.new(1999, 12, 31), ActiveSupport::TimeZone['Eastern Time (US & Canada)'].today - Time.stubs(:now).returns(Time.utc(2000, 1, 1, 5)) # midnight Jan 1 EST - assert_equal Date.new(2000, 1, 1), ActiveSupport::TimeZone['Eastern Time (US & Canada)'].today - Time.stubs(:now).returns(Time.utc(2000, 1, 2, 4, 59, 59)) # 1 sec before midnight Jan 2 EST - assert_equal Date.new(2000, 1, 1), ActiveSupport::TimeZone['Eastern Time (US & Canada)'].today - Time.stubs(:now).returns(Time.utc(2000, 1, 2, 5)) # midnight Jan 2 EST - assert_equal Date.new(2000, 1, 2), ActiveSupport::TimeZone['Eastern Time (US & Canada)'].today - end + def test_today + Time.stubs(:now).returns(Time.utc(2000, 1, 1, 4, 59, 59)) # 1 sec before midnight Jan 1 EST + assert_equal Date.new(1999, 12, 31), ActiveSupport::TimeZone['Eastern Time (US & Canada)'].today + Time.stubs(:now).returns(Time.utc(2000, 1, 1, 5)) # midnight Jan 1 EST + assert_equal Date.new(2000, 1, 1), ActiveSupport::TimeZone['Eastern Time (US & Canada)'].today + Time.stubs(:now).returns(Time.utc(2000, 1, 2, 4, 59, 59)) # 1 sec before midnight Jan 2 EST + assert_equal Date.new(2000, 1, 1), ActiveSupport::TimeZone['Eastern Time (US & Canada)'].today + Time.stubs(:now).returns(Time.utc(2000, 1, 2, 5)) # midnight Jan 2 EST + assert_equal Date.new(2000, 1, 2), ActiveSupport::TimeZone['Eastern Time (US & Canada)'].today end def test_local @@ -206,13 +204,11 @@ class TimeZoneTest < Test::Unit::TestCase end end - uses_mocha 'TestParseWithIncompleteDate' do - def test_parse_with_incomplete_date - zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] - zone.stubs(:now).returns zone.local(1999,12,31) - twz = zone.parse('19:00:00') - assert_equal Time.utc(1999,12,31,19), twz.time - end + def test_parse_with_incomplete_date + zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] + zone.stubs(:now).returns zone.local(1999,12,31) + twz = zone.parse('19:00:00') + assert_equal Time.utc(1999,12,31,19), twz.time end def test_utc_offset_lazy_loaded_from_tzinfo_when_not_passed_in_to_initialize |