aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/datatype_test.rb
diff options
context:
space:
mode:
authorTroy Kruthoff <tkruthoff@gmail.com>2013-03-01 09:12:30 -0800
committerTroy Kruthoff <tkruthoff@gmail.com>2013-03-01 09:51:23 -0800
commit2cc09441c2de57b024b11ba666ba1e72c2b20cfe (patch)
tree4595e1cd51c5fbaaa452a57e40f224808b3a91d8 /activerecord/test/cases/adapters/postgresql/datatype_test.rb
parentb49a2a779ba6deba108d1f842ab5b7bc7460aa14 (diff)
downloadrails-2cc09441c2de57b024b11ba666ba1e72c2b20cfe.tar.gz
rails-2cc09441c2de57b024b11ba666ba1e72c2b20cfe.tar.bz2
rails-2cc09441c2de57b024b11ba666ba1e72c2b20cfe.zip
Fix PostgreSQL TIMESTAMP WITH TIME ZONE to return ActiveSupport::Time
In an AR model a timestamptz attribute would return a ruby string and AR tests did not check for any type casting. Previous tests would pass only because an assert_equal was being used on a Time.utc object, which will parse the right side of the eq to a valid Time instance for comparision. switch to test instance of Time instead of ActiveSupport::TimeWithZone
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/datatype_test.rb')
-rw-r--r--activerecord/test/cases/adapters/postgresql/datatype_test.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/datatype_test.rb b/activerecord/test/cases/adapters/postgresql/datatype_test.rb
index 33c796191e..1e6ae85a25 100644
--- a/activerecord/test/cases/adapters/postgresql/datatype_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/datatype_test.rb
@@ -573,6 +573,7 @@ _SQL
@first_timestamp_with_zone = PostgresqlTimestampWithZone.find(1)
assert_equal Time.utc(2010,1,1, 11,0,0), @first_timestamp_with_zone.time
+ assert_instance_of Time, @first_timestamp_with_zone.time
ensure
ActiveRecord::Base.default_timezone = old_default_tz
ActiveRecord::Base.time_zone_aware_attributes = old_tz
@@ -590,6 +591,7 @@ _SQL
@first_timestamp_with_zone = PostgresqlTimestampWithZone.find(1)
assert_equal Time.utc(2010,1,1, 11,0,0), @first_timestamp_with_zone.time
+ assert_instance_of Time, @first_timestamp_with_zone.time
ensure
ActiveRecord::Base.default_timezone = old_default_tz
ActiveRecord::Base.time_zone_aware_attributes = old_tz