aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/array_test.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-06-07 06:39:27 -0600
committerSean Griffin <sean@thoughtbot.com>2014-06-07 06:43:39 -0600
commit1c181c295034a1b3ba8aefb9aede6552d8ff69e4 (patch)
treea9e778fd7bc0e9f4b036a2babd0e4ec1490bd2ab /activerecord/test/cases/adapters/postgresql/array_test.rb
parent17fc6f16eb2be481a4d036bea58b3e4ae0052f3a (diff)
downloadrails-1c181c295034a1b3ba8aefb9aede6552d8ff69e4.tar.gz
rails-1c181c295034a1b3ba8aefb9aede6552d8ff69e4.tar.bz2
rails-1c181c295034a1b3ba8aefb9aede6552d8ff69e4.zip
Add array support when time zone aware attributes are enabled
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/array_test.rb')
-rw-r--r--activerecord/test/cases/adapters/postgresql/array_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/array_test.rb b/activerecord/test/cases/adapters/postgresql/array_test.rb
index e03d83df59..90b72563fa 100644
--- a/activerecord/test/cases/adapters/postgresql/array_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/array_test.rb
@@ -12,6 +12,7 @@ class PostgresqlArrayTest < ActiveRecord::TestCase
@connection.create_table('pg_arrays') do |t|
t.string 'tags', array: true
t.integer 'ratings', array: true
+ t.datetime :datetimes, array: true
end
end
@column = PgArray.columns_hash['tags']
@@ -195,6 +196,21 @@ class PostgresqlArrayTest < ActiveRecord::TestCase
assert_equal tags, ar.tags
end
+ def test_datetime_with_timezone_awareness
+ with_timezone_config aware_attributes: true do
+ PgArray.reset_column_information
+ current_time = [Time.current]
+
+ record = PgArray.new(datetimes: current_time)
+ assert_equal current_time, record.datetimes
+
+ record.save!
+ record.reload
+
+ assert_equal current_time, record.datetimes
+ end
+ end
+
private
def assert_cycle field, array
# test creation