aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/support
diff options
context:
space:
mode:
authorGuo Xiang Tan <tgx_world@hotmail.com>2014-03-31 21:53:43 -0700
committerGuo Xiang Tan <tgx_world@hotmail.com>2014-04-01 21:34:11 -0700
commit9896c5fba9686524600d58e703e2aae80105043b (patch)
tree0c482459a8206758a93aba1c7d76deba70fa09d1 /activerecord/test/support
parent5fa65f94b8c16019d2ddd55f2e59b1bf1c87db89 (diff)
downloadrails-9896c5fba9686524600d58e703e2aae80105043b.tar.gz
rails-9896c5fba9686524600d58e703e2aae80105043b.tar.bz2
rails-9896c5fba9686524600d58e703e2aae80105043b.zip
Allow postgresql enum_test to be run in random order.
Creating and dropping similar tables within the same connection causes postgresql to look up old values in the cache of tables which have already been dropped.
Diffstat (limited to 'activerecord/test/support')
-rw-r--r--activerecord/test/support/postgresql_helper.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/support/postgresql_helper.rb b/activerecord/test/support/postgresql_helper.rb
new file mode 100644
index 0000000000..fa40a46499
--- /dev/null
+++ b/activerecord/test/support/postgresql_helper.rb
@@ -0,0 +1,8 @@
+module PostgresqlHelper
+ # Make sure to drop all cached query plans to prevent invalid reference errors like:
+ # cache lookup failed for type XYZ
+ def reset_pg_session
+ original_connection = ActiveRecord::Base.remove_connection
+ ActiveRecord::Base.establish_connection(original_connection)
+ end
+end