diff options
author | John Firebaugh <john_firebaugh@us.ibm.com> | 2011-01-06 13:33:36 -0800 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-02-03 13:12:03 -0200 |
commit | 080345baca1076a9788dff4803153600aec31f86 (patch) | |
tree | c0264cc663adea51c30838b542e9295e480937d9 /activesupport/test | |
parent | bf0395837fc735bf98daed23f475b267e48c1118 (diff) | |
download | rails-080345baca1076a9788dff4803153600aec31f86.tar.gz rails-080345baca1076a9788dff4803153600aec31f86.tar.bz2 rails-080345baca1076a9788dff4803153600aec31f86.zip |
Ruby 1.8.7+ provides to_date/to_datetime, AS just makes them public.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/time_ext_test.rb | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index 53d497013a..891a6badac 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -533,19 +533,9 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase Time::DATE_FORMATS.delete(:custom) end - def test_to_date - assert_equal Date.new(2005, 2, 21), Time.local(2005, 2, 21, 17, 44, 30).to_date - end - - def test_to_datetime - assert_equal Time.utc(2005, 2, 21, 17, 44, 30).to_datetime, DateTime.civil(2005, 2, 21, 17, 44, 30, 0, 0) - with_env_tz 'US/Eastern' do - assert_equal Time.local(2005, 2, 21, 17, 44, 30).to_datetime, DateTime.civil(2005, 2, 21, 17, 44, 30, Rational(Time.local(2005, 2, 21, 17, 44, 30).utc_offset, 86400), 0) - end - with_env_tz 'NZ' do - assert_equal Time.local(2005, 2, 21, 17, 44, 30).to_datetime, DateTime.civil(2005, 2, 21, 17, 44, 30, Rational(Time.local(2005, 2, 21, 17, 44, 30).utc_offset, 86400), 0) - end - assert_equal ::Date::ITALY, Time.utc(2005, 2, 21, 17, 44, 30).to_datetime.start # use Ruby's default start value + def test_conversion_methods_are_publicized + assert Time.public_instance_methods.include?(:to_date) || Time.public_instance_methods.include?('to_date') + assert Time.public_instance_methods.include?(:to_datetime) || Time.public_instance_methods.include?('to_datetime') end def test_to_time |