diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2012-05-04 15:34:11 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2012-05-04 15:34:11 -0700 |
commit | fecfd61c227376d8d07f9e4ea638df496c2b08dc (patch) | |
tree | 893f05a201152e721152074279ba14faa25a1494 /activesupport/test/core_ext/time_ext_test.rb | |
parent | db6a399c8a7ddd3457fcb1aac388fd4d5fb7e748 (diff) | |
parent | 8c3f4bec1fc6b50025f256f5244acbb8e892c9ee (diff) | |
download | rails-fecfd61c227376d8d07f9e4ea638df496c2b08dc.tar.gz rails-fecfd61c227376d8d07f9e4ea638df496c2b08dc.tar.bz2 rails-fecfd61c227376d8d07f9e4ea638df496c2b08dc.zip |
Merge pull request #6156 from mjtko/feature-beginning_of_hour
Beginning and end of hour support for Time and DateTime
Diffstat (limited to 'activesupport/test/core_ext/time_ext_test.rb')
-rw-r--r-- | activesupport/test/core_ext/time_ext_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index c542acca68..4c1ed4b1ae 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -93,6 +93,10 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase end end + def test_beginning_of_hour + assert_equal Time.local(2005,2,4,19,0,0), Time.local(2005,2,4,19,30,10).beginning_of_hour + end + def test_beginning_of_month assert_equal Time.local(2005,2,1,0,0,0), Time.local(2005,2,22,10,10,10).beginning_of_month end @@ -127,6 +131,10 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase assert_equal Time.local(2007,9,2,23,59,59,999999.999), Time.local(2007,9,02,0,0,0).end_of_week #sunday end + def test_end_of_hour + assert_equal Time.local(2005,2,4,19,59,59,999999.999), Time.local(2005,2,4,19,30,10).end_of_hour + end + def test_end_of_month assert_equal Time.local(2005,3,31,23,59,59,999999.999), Time.local(2005,3,20,10,10,10).end_of_month assert_equal Time.local(2005,2,28,23,59,59,999999.999), Time.local(2005,2,20,10,10,10).end_of_month |