From ebd27d5714e20e6301a52989ae3c9e73f55ce29d Mon Sep 17 00:00:00 2001 From: Kelly Stannard Date: Wed, 2 Jan 2013 23:50:55 +0000 Subject: Better error message for String#to_date I did this because to_date gives a very unhelpful error message if you do not pass in a correct date. In the process I think this cleans up the code nicely and even better it tends to be slightly faster than the current implementation. Benchmark https://gist.github.com/4440875 --- activesupport/test/core_ext/string_ext_test.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index fa8839bcb3..e0ddeab548 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -307,6 +307,7 @@ class StringConversionsTest < ActiveSupport::TestCase def test_string_to_date assert_equal Date.new(2005, 2, 27), "2005-02-27".to_date assert_nil "".to_date + assert_equal Date.new(Date.today.year, 2, 3), "Feb 3rd".to_date end end -- cgit v1.2.3