Permalink
Browse files

Enable hstore extensions on tests if it is not enabled and database s…

…upports it
  • Loading branch information...
rafaelfranca committed Feb 5, 2013
1 parent 655e95c commit b713f1b3ccd27ef05783a3f4259bb114c033c57b
Showing with 8 additions and 1 deletion.
  1. +8 −1 activerecord/test/cases/adapters/postgresql/hstore_test.rb
@@ -11,11 +11,18 @@ class Hstore < ActiveRecord::Base
def setup
@connection = ActiveRecord::Base.connection
+
+ unless @connection.supports_extensions?
+ return skip "do not test on PG without hstore"
+ end
+
unless @connection.extension_enabled?('hstore')
@connection.enable_extension 'hstore'
- return skip "do not test on PG without hstore"
+ @connection.commit_db_transaction
end
+ @connection.reconnect!
+
@connection.transaction do
@connection.create_table('hstores') do |t|
t.hstore 'tags', :default => ''

0 comments on commit b713f1b

Please sign in to comment.