aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/duration_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext/duration_test.rb')
-rw-r--r--activesupport/test/core_ext/duration_test.rb32
1 files changed, 12 insertions, 20 deletions
diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb
index ab5a86668e..d4a4627e3e 100644
--- a/activesupport/test/core_ext/duration_test.rb
+++ b/activesupport/test/core_ext/duration_test.rb
@@ -60,26 +60,6 @@ class DurationTest < ActiveSupport::TestCase
assert_equal((7 * 24 * 1.7).hours.ago, 1.7.weeks.ago)
end
- def test_deprecated_fractional_years
- years_re = /Fractional years are not respected\. Convert value to integer before calling #years\./
- assert_deprecated(years_re){1.0.years}
- assert_deprecated(years_re){1.5.years}
- assert_not_deprecated{1.years}
- assert_deprecated(years_re){1.0.year}
- assert_deprecated(years_re){1.5.year}
- assert_not_deprecated{1.year}
- end
-
- def test_deprecated_fractional_months
- months_re = /Fractional months are not respected\. Convert value to integer before calling #months\./
- assert_deprecated(months_re){1.5.months}
- assert_deprecated(months_re){1.0.months}
- assert_not_deprecated{1.months}
- assert_deprecated(months_re){1.5.month}
- assert_deprecated(months_re){1.0.month}
- assert_not_deprecated{1.month}
- end
-
def test_since_and_ago_anchored_to_time_now_when_time_zone_default_not_set
Time.zone_default = nil
with_env_tz 'US/Eastern' do
@@ -109,6 +89,18 @@ class DurationTest < ActiveSupport::TestCase
ensure
Time.zone_default = nil
end
+
+ def test_adding_hours_across_dst_boundary
+ with_env_tz 'CET' do
+ assert_equal Time.local(2009,3,29,0,0,0) + 24.hours, Time.local(2009,3,30,1,0,0)
+ end
+ end
+
+ def test_adding_day_across_dst_boundary
+ with_env_tz 'CET' do
+ assert_equal Time.local(2009,3,29,0,0,0) + 1.day, Time.local(2009,3,30,0,0,0)
+ end
+ end
protected
def with_env_tz(new_tz = 'US/Eastern')