aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/attribute_methods_test.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2011-03-30 20:56:05 -0500
committerJoshua Peek <josh@joshpeek.com>2011-03-30 20:56:05 -0500
commit5df076ad0965dc684afff8a019fd9f92a53ada76 (patch)
treeb2272d3d7f0ed6713d888390a13b130c65aec6f3 /activerecord/test/cases/attribute_methods_test.rb
parentac9443ed71bf0b40cf5b321e8e1b77b98abd9b5e (diff)
parent9772de8d459960cc114c5b214343b7ce08fea21c (diff)
downloadrails-5df076ad0965dc684afff8a019fd9f92a53ada76.tar.gz
rails-5df076ad0965dc684afff8a019fd9f92a53ada76.tar.bz2
rails-5df076ad0965dc684afff8a019fd9f92a53ada76.zip
Merge branch 'master' into sprockets
Diffstat (limited to 'activerecord/test/cases/attribute_methods_test.rb')
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb26
1 files changed, 11 insertions, 15 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb
index dfacf58da8..d8638ee776 100644
--- a/activerecord/test/cases/attribute_methods_test.rb
+++ b/activerecord/test/cases/attribute_methods_test.rb
@@ -118,22 +118,18 @@ class AttributeMethodsTest < ActiveRecord::TestCase
end
def test_read_attributes_before_type_cast_on_datetime
- developer = Developer.find(:first)
- if current_adapter?(:Mysql2Adapter, :OracleAdapter)
- # Mysql2 and Oracle adapters keep the value in Time instance
- assert_equal developer.created_at.to_s(:db), developer.attributes_before_type_cast["created_at"].to_s(:db)
- else
- assert_equal developer.created_at.to_s(:db), developer.attributes_before_type_cast["created_at"].to_s
+ in_time_zone "Pacific Time (US & Canada)" do
+ record = @target.new
+
+ record.written_on = "345643456"
+ assert_equal "345643456", record.written_on_before_type_cast
+ assert_equal nil, record.written_on
+
+ record.written_on = "2009-10-11 12:13:14"
+ assert_equal "2009-10-11 12:13:14", record.written_on_before_type_cast
+ assert_equal Time.zone.parse("2009-10-11 12:13:14"), record.written_on
+ assert_equal ActiveSupport::TimeZone["Pacific Time (US & Canada)"], record.written_on.time_zone
end
-
- developer.created_at = "345643456"
-
- assert_equal developer.created_at_before_type_cast, "345643456"
- assert_equal developer.created_at, nil
-
- developer.created_at = "2010-03-21 21:23:32"
- assert_equal developer.created_at_before_type_cast, "2010-03-21 21:23:32"
- assert_equal developer.created_at, Time.parse("2010-03-21 21:23:32")
end
def test_hash_content