aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-01-07 03:08:03 -0800
committerYves Senn <yves.senn@gmail.com>2014-01-07 03:08:03 -0800
commitab21f42245b1e6fa9ccf03d4ebe190803add1569 (patch)
treead0902bc0e7077d8c92ebe3834d46d71a25e3321 /activerecord/test/cases/adapters
parent3a33e8ea85f025d5ba575318583d1038889a2ba1 (diff)
parenteb589fed6f4950d441bc6aed8dfaaeffec061322 (diff)
downloadrails-ab21f42245b1e6fa9ccf03d4ebe190803add1569.tar.gz
rails-ab21f42245b1e6fa9ccf03d4ebe190803add1569.tar.bz2
rails-ab21f42245b1e6fa9ccf03d4ebe190803add1569.zip
Merge pull request #13597 from prathamesh-sonpatki/hstore_migration
Make change_table use object of current database adapter
Diffstat (limited to 'activerecord/test/cases/adapters')
-rw-r--r--activerecord/test/cases/adapters/postgresql/hstore_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/hstore_test.rb b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
index 6df5d8f533..d8782f5eaa 100644
--- a/activerecord/test/cases/adapters/postgresql/hstore_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/hstore_test.rb
@@ -70,6 +70,23 @@ class PostgresqlHstoreTest < ActiveRecord::TestCase
Hstore.reset_column_information
end
+ def test_hstore_migration
+ hstore_migration = Class.new(ActiveRecord::Migration) do
+ def change
+ change_table("hstores") do |t|
+ t.hstore :keys
+ end
+ end
+ end
+
+ hstore_migration.new.suppress_messages do
+ hstore_migration.migrate(:up)
+ assert_includes @connection.columns(:hstores).map(&:name), "keys"
+ hstore_migration.migrate(:down)
+ assert_not_includes @connection.columns(:hstores).map(&:name), "keys"
+ end
+ end
+
def test_cast_value_on_write
x = Hstore.new tags: {"bool" => true, "number" => 5}
assert_equal({"bool" => "true", "number" => "5"}, x.tags)