diff options
author | Dongqing Hu <sorra@outlook.com> | 2017-02-26 03:20:12 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-26 03:20:12 -0600 |
commit | 9ce2405b3c7f4f555becef162ea2e8af341d47c9 (patch) | |
tree | 79741c67a8c7e31bb7e30d9bd1d771e3ff419228 /activesupport/test | |
parent | 143a6cfcf65082343fa2c5c0af4a62fa732c8ad9 (diff) | |
parent | 2d84a6bc74fbe9d9b97bf7d63ec6f27418d9c3a6 (diff) | |
download | rails-9ce2405b3c7f4f555becef162ea2e8af341d47c9.tar.gz rails-9ce2405b3c7f4f555becef162ea2e8af341d47c9.tar.bz2 rails-9ce2405b3c7f4f555becef162ea2e8af341d47c9.zip |
Merge branch 'master' into fresh-thread-tagged-logging
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/duration_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index 6a275d1d5b..6facb04f1f 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -179,6 +179,19 @@ class DurationTest < ActiveSupport::TestCase Time.zone = nil end + def test_before_and_afer + t = Time.local(2000) + assert_equal t + 1, 1.second.after(t) + assert_equal t - 1, 1.second.before(t) + end + + def test_before_and_after_without_argument + Time.stub(:now, Time.local(2000)) do + assert_equal Time.now - 1.second, 1.second.before + assert_equal Time.now + 1.second, 1.second.after + end + 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) |