aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorVasiliy Ermolovich <younash@gmail.com>2012-05-06 23:33:12 +0300
committerVasiliy Ermolovich <younash@gmail.com>2012-05-17 08:24:42 +0300
commite2e513621d732abb8efff9120bd9a444836720d6 (patch)
tree79ae1396eb2184bf1a8dafe5278a6146308688bc /activesupport/test
parenta29bc1cf7b8580a815523e4c3a79e931f03ab8c2 (diff)
downloadrails-e2e513621d732abb8efff9120bd9a444836720d6.tar.gz
rails-e2e513621d732abb8efff9120bd9a444836720d6.tar.bz2
rails-e2e513621d732abb8efff9120bd9a444836720d6.zip
wrap time ranges with timezones, closes #6179
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/time_ext_test.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb
index 4c1ed4b1ae..884b95f162 100644
--- a/activesupport/test/core_ext/time_ext_test.rb
+++ b/activesupport/test/core_ext/time_ext_test.rb
@@ -517,7 +517,7 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal Time.local(2006,11,15), Time.local(2006,11,23,0,0,0).prev_week(:wednesday)
end
end
-
+
def test_last_week
with_env_tz 'US/Eastern' do
assert_equal Time.local(2005,2,21), Time.local(2005,3,1,15,15,10).last_week
@@ -831,6 +831,14 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal Time.local(2011,6,7,0,0,0)..Time.local(2011,6,7,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).all_day
end
+ def test_all_day_with_timezone
+ beginning_of_day = ActiveSupport::TimeWithZone.new(nil, ActiveSupport::TimeZone["Hawaii"], Time.local(2011,6,7,0,0,0))
+ end_of_day = ActiveSupport::TimeWithZone.new(nil, ActiveSupport::TimeZone["Hawaii"], Time.local(2011,6,7,23,59,59,999999.999))
+
+ assert_equal beginning_of_day.inspect, ActiveSupport::TimeWithZone.new(Time.local(2011,6,7,10,10,10), ActiveSupport::TimeZone["Hawaii"]).all_day.begin.inspect
+ assert_equal end_of_day.inspect, ActiveSupport::TimeWithZone.new(Time.local(2011,6,7,10,10,10), ActiveSupport::TimeZone["Hawaii"]).all_day.end.inspect
+ end
+
def test_all_week
assert_equal Time.local(2011,6,6,0,0,0)..Time.local(2011,6,12,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).all_week
assert_equal Time.local(2011,6,5,0,0,0)..Time.local(2011,6,11,23,59,59,999999.999), Time.local(2011,6,7,10,10,10).all_week(:sunday)