aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/time_with_zone_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2012-05-04 15:34:11 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2012-05-04 15:34:11 -0700
commitfecfd61c227376d8d07f9e4ea638df496c2b08dc (patch)
tree893f05a201152e721152074279ba14faa25a1494 /activesupport/test/core_ext/time_with_zone_test.rb
parentdb6a399c8a7ddd3457fcb1aac388fd4d5fb7e748 (diff)
parent8c3f4bec1fc6b50025f256f5244acbb8e892c9ee (diff)
downloadrails-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_with_zone_test.rb')
-rw-r--r--activesupport/test/core_ext/time_with_zone_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb
index 331010091e..bc6ebbb765 100644
--- a/activesupport/test/core_ext/time_with_zone_test.rb
+++ b/activesupport/test/core_ext/time_with_zone_test.rb
@@ -512,6 +512,20 @@ class TimeWithZoneTest < ActiveSupport::TestCase
assert_equal "Fri, 31 Dec 1999 23:59:59 EST -05:00", @twz.end_of_day.inspect
end
+ def test_beginning_of_hour
+ utc = Time.utc(2000, 1, 1, 0, 30)
+ twz = ActiveSupport::TimeWithZone.new(utc, @time_zone)
+ assert_equal "Fri, 31 Dec 1999 19:30:00 EST -05:00", twz.inspect
+ assert_equal "Fri, 31 Dec 1999 19:00:00 EST -05:00", twz.beginning_of_hour.inspect
+ end
+
+ def test_end_of_hour
+ utc = Time.utc(2000, 1, 1, 0, 30)
+ twz = ActiveSupport::TimeWithZone.new(utc, @time_zone)
+ assert_equal "Fri, 31 Dec 1999 19:30:00 EST -05:00", twz.inspect
+ assert_equal "Fri, 31 Dec 1999 19:59:59 EST -05:00", twz.end_of_hour.inspect
+ end
+
def test_since
assert_equal "Fri, 31 Dec 1999 19:00:01 EST -05:00", @twz.since(1).inspect
end