aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2013-09-20 00:13:33 +0900
committerkennyj <kennyj@gmail.com>2013-09-25 00:08:40 +0900
commit8dd5a582f544ca86add20d46c2a62b965b28e08a (patch)
tree5a552d3a5de2835b3a90e83c55d2f05c6c44ed8b /activerecord/test
parent16c7873c44cbced87b153bcbc7ac7ecfe950b53c (diff)
downloadrails-8dd5a582f544ca86add20d46c2a62b965b28e08a.tar.gz
rails-8dd5a582f544ca86add20d46c2a62b965b28e08a.tar.bz2
rails-8dd5a582f544ca86add20d46c2a62b965b28e08a.zip
ActiveRecord::ConnectionAdapters::Column.string_to_time method respects string with timezone. Closes #12278.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/column_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/column_test.rb b/activerecord/test/cases/column_test.rb
index 3a4f414ae8..5ab2f18e9d 100644
--- a/activerecord/test/cases/column_test.rb
+++ b/activerecord/test/cases/column_test.rb
@@ -110,6 +110,16 @@ module ActiveRecord
assert_equal 1800, column.type_cast(30.minutes)
assert_equal 7200, column.type_cast(2.hours)
end
+
+ def test_string_to_time_with_timezone
+ old = ActiveRecord::Base.default_timezone
+ [:utc, :local].each do |zone|
+ ActiveRecord::Base.default_timezone = zone
+ assert_equal Time.utc(2013, 9, 4, 0, 0, 0), Column.string_to_time("Wed, 04 Sep 2013 03:00:00 EAT")
+ end
+ rescue
+ ActiveRecord::Base.default_timezone = old
+ end
end
end
end