aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2014-06-08 01:03:06 +0930
committerMatthew Draper <matthew@trebex.net>2014-06-08 01:03:06 +0930
commit2f5fab8d5af6dfe59e73fcf3d8d9902715b4284b (patch)
treecaf91ce1f40241d55630336c0bd1f916e0113299 /activerecord
parent16f595f1b6cb8d248c93c5fd2c7033771edf2426 (diff)
parentda9ed153f7ff95026f322a54f64d0b8795511226 (diff)
downloadrails-2f5fab8d5af6dfe59e73fcf3d8d9902715b4284b.tar.gz
rails-2f5fab8d5af6dfe59e73fcf3d8d9902715b4284b.tar.bz2
rails-2f5fab8d5af6dfe59e73fcf3d8d9902715b4284b.zip
Merge pull request #15557 from sgrif/sg-specify-time-zone
Specify a time zone when testing TZ aware attributes
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/adapters/postgresql/array_test.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/array_test.rb b/activerecord/test/cases/adapters/postgresql/array_test.rb
index 90b72563fa..c78c502478 100644
--- a/activerecord/test/cases/adapters/postgresql/array_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/array_test.rb
@@ -2,6 +2,8 @@
require "cases/helper"
class PostgresqlArrayTest < ActiveRecord::TestCase
+ include InTimeZone
+
class PgArray < ActiveRecord::Base
self.table_name = 'pg_arrays'
end
@@ -197,17 +199,20 @@ class PostgresqlArrayTest < ActiveRecord::TestCase
end
def test_datetime_with_timezone_awareness
- with_timezone_config aware_attributes: true do
+ tz = "Pacific Time (US & Canada)"
+
+ in_time_zone tz do
PgArray.reset_column_information
- current_time = [Time.current]
+ time_string = Time.current.to_s
+ time = Time.zone.parse(time_string)
- record = PgArray.new(datetimes: current_time)
- assert_equal current_time, record.datetimes
+ record = PgArray.new(datetimes: [time_string])
+ assert_equal [time], record.datetimes
record.save!
record.reload
- assert_equal current_time, record.datetimes
+ assert_equal [time], record.datetimes
end
end