aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorSiim Liiser <siim@wisemedia.ee>2016-01-13 11:19:23 +0200
committerAndrew White <andrew.white@unboxedconsulting.com>2016-04-04 00:00:31 +0100
commit9c2c677d903bcdea3feb1cad6c6d4c8c07cc8034 (patch)
tree6a91583bda2febe69db837af6eac54679b8ab22f /activesupport/test
parent08073125a5bd4cae0f2e02723e7743a389d496cd (diff)
downloadrails-9c2c677d903bcdea3feb1cad6c6d4c8c07cc8034.tar.gz
rails-9c2c677d903bcdea3feb1cad6c6d4c8c07cc8034.tar.bz2
rails-9c2c677d903bcdea3feb1cad6c6d4c8c07cc8034.zip
Match `String#to_time`'s behaviour to ruby
Previously `String#to_time` returned the midnight of the current date in some cases where there was no relavant information in the string. Now the method returns `nil` instead in those cases. Fixes #22958.
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index 4761ce580c..f38b225b38 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -456,6 +456,7 @@ class StringConversionsTest < ActiveSupport::TestCase
assert_equal Time.local(2011, 2, 27, 17, 50), "2011-02-27 13:50 -0100".to_time
assert_equal Time.utc(2011, 2, 27, 23, 50), "2011-02-27 22:50 -0100".to_time(:utc)
assert_equal Time.local(2005, 2, 27, 22, 50), "2005-02-27 14:50 -0500".to_time
+ assert_nil "010".to_time
assert_nil "".to_time
end
end