mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
reverted tests deleted by 080345baca
, refactored implementations should not invalidate the validations
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
This commit is contained in:
parent
7872cc992b
commit
1f47061b48
1 changed files with 13 additions and 3 deletions
|
@ -533,9 +533,19 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
|
||||||
Time::DATE_FORMATS.delete(:custom)
|
Time::DATE_FORMATS.delete(:custom)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_conversion_methods_are_publicized
|
def test_to_date
|
||||||
assert Time.public_instance_methods.include?(:to_date) || Time.public_instance_methods.include?('to_date')
|
assert_equal Date.new(2005, 2, 21), Time.local(2005, 2, 21, 17, 44, 30).to_date
|
||||||
assert Time.public_instance_methods.include?(:to_datetime) || Time.public_instance_methods.include?('to_datetime')
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_to_time
|
def test_to_time
|
||||||
|
|
Loading…
Reference in a new issue