aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/time_zone_test.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2014-02-18 10:22:43 +0100
committerXavier Noria <fxn@hashref.com>2014-02-18 10:25:11 +0100
commit5d037819ca80606638212f83de741cc2041db28f (patch)
treee6692777827b70641809d94f3b708c32140292e6 /activesupport/test/time_zone_test.rb
parent24fa399c99316d8765c7ec374050b609e362b1c6 (diff)
downloadrails-5d037819ca80606638212f83de741cc2041db28f.tar.gz
rails-5d037819ca80606638212f83de741cc2041db28f.tar.bz2
rails-5d037819ca80606638212f83de741cc2041db28f.zip
travel_to travels back and re-raises if the block raises
Diffstat (limited to 'activesupport/test/time_zone_test.rb')
-rw-r--r--activesupport/test/time_zone_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb
index 9fa2f45de5..79ec57af2b 100644
--- a/activesupport/test/time_zone_test.rb
+++ b/activesupport/test/time_zone_test.rb
@@ -138,6 +138,18 @@ class TimeZoneTest < ActiveSupport::TestCase
end
end
+ def test_travel_to_travels_back_and_reraises_if_the_block_raises
+ ts = Time.current - 1.second
+
+ travel_to ts do
+ raise
+ end
+
+ flunk # ensure travel_to re-raises
+ rescue
+ assert_not_equal ts, Time.current
+ end
+
def test_local
time = ActiveSupport::TimeZone["Hawaii"].local(2007, 2, 5, 15, 30, 45)
assert_equal Time.utc(2007, 2, 5, 15, 30, 45), time.time