1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

InstanceTag#default_time_from_options overflows to DateTime

This commit is contained in:
gbuesing 2008-05-18 10:59:24 -05:00
parent be85868987
commit e30a263bf1
3 changed files with 9 additions and 1 deletions

View file

@ -1,3 +1,5 @@
* InstanceTag#default_time_from_options overflows to DateTime [Geoff Buesing]
*2.1.0 RC1 (May 11th, 2008)*
* Fixed that forgery protection can be used without session tracking (Peter Jones) [#139]

View file

@ -689,7 +689,7 @@ module ActionView
default[key] ||= time.send(key)
end
Time.utc(default[:year], default[:month], default[:day], default[:hour], default[:min], default[:sec])
Time.utc_time(default[:year], default[:month], default[:day], default[:hour], default[:min], default[:sec])
end
end
end

View file

@ -1722,6 +1722,12 @@ class DateHelperTest < ActionView::TestCase
assert_equal 2, dummy_instance_tag.send!(:default_time_from_options, :hour => 2).hour
end
end
def test_instance_tag_default_time_from_options_handles_far_future_date
dummy_instance_tag = ActionView::Helpers::InstanceTag.new(1,2,3)
time = dummy_instance_tag.send!(:default_time_from_options, :year => 2050, :month => 2, :day => 10, :hour => 15, :min => 30, :sec => 45)
assert_equal 2050, time.year
end
end
protected