aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2018-02-07 15:06:21 -0500
committerGitHub <noreply@github.com>2018-02-07 15:06:21 -0500
commit5ae2ecab6d3365f6f17e3c8cb298dfeeea113774 (patch)
tree504921f5f0fa56f69780cd0dcaea29b32615754c /activesupport/test
parentc5d431e469505ec4438f9fd37530dd9c79c8a872 (diff)
parenta467c6bdd5722c09f5a15c0a7c5c40cc99c8be25 (diff)
downloadrails-5ae2ecab6d3365f6f17e3c8cb298dfeeea113774.tar.gz
rails-5ae2ecab6d3365f6f17e3c8cb298dfeeea113774.tar.bz2
rails-5ae2ecab6d3365f6f17e3c8cb298dfeeea113774.zip
Merge pull request #31923 from jdelStrother/duration-deserialization
Fix yaml deserialization of ActiveSupport::Duration
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/duration_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb
index 4a02f27def..be33324f25 100644
--- a/activesupport/test/core_ext/duration_test.rb
+++ b/activesupport/test/core_ext/duration_test.rb
@@ -642,6 +642,12 @@ class DurationTest < ActiveSupport::TestCase
assert_equal time + d1, time + d2
end
+ def test_durations_survive_yaml_serialization
+ d1 = YAML.load(YAML.dump(10.minutes))
+ assert_equal 600, d1.to_i
+ assert_equal 660, (d1 + 60).to_i
+ end
+
private
def eastern_time_zone
if Gem.win_platform?