diff options
author | Mark J. Titorenko <mark@titorenko.net> | 2012-05-04 15:18:59 +0100 |
---|---|---|
committer | Mark J. Titorenko <mark@titorenko.net> | 2012-05-04 16:01:57 +0100 |
commit | 8c3f4bec1fc6b50025f256f5244acbb8e892c9ee (patch) | |
tree | 5e715a3af8d2b4c28277539aad6ed310ee16bf8a /activesupport/test/core_ext/time_ext_test.rb | |
parent | 510cf0ad93f07e9285178c8b7ba7d4d68c139fec (diff) | |
download | rails-8c3f4bec1fc6b50025f256f5244acbb8e892c9ee.tar.gz rails-8c3f4bec1fc6b50025f256f5244acbb8e892c9ee.tar.bz2 rails-8c3f4bec1fc6b50025f256f5244acbb8e892c9ee.zip |
added beginning_of_hour support to core_ext calculations 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 |