Skip to content

Commit

Permalink
Enable hstore extensions on tests if it is not enabled and database s…
Browse files Browse the repository at this point in the history
…upports it
  • Loading branch information
rafaelfranca committed Feb 5, 2013
1 parent 655e95c commit b713f1b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion activerecord/test/cases/adapters/postgresql/hstore_test.rb
Expand Up @@ -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 => ''
Expand Down

0 comments on commit b713f1b

Please sign in to comment.