diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-09-05 19:20:19 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-09-05 19:20:19 -0300 |
commit | aca714eaa01f81a2be02e7dc5c8b03106f8dcb2d (patch) | |
tree | 0a5a1b5b3017402ab019e0fdf4712c16a0948289 /activerecord/test/cases/helper.rb | |
parent | d12b9b28972b326a7dd96cd27aa613ae0f47bdf8 (diff) | |
parent | 0ab9301f2acb5e14846c4241701a9d9d57ce35ce (diff) | |
download | rails-aca714eaa01f81a2be02e7dc5c8b03106f8dcb2d.tar.gz rails-aca714eaa01f81a2be02e7dc5c8b03106f8dcb2d.tar.bz2 rails-aca714eaa01f81a2be02e7dc5c8b03106f8dcb2d.zip |
Merge pull request #16114 from seuros/test_clean
[Postgresql tests] Added enable_extension! to helper
Diffstat (limited to 'activerecord/test/cases/helper.rb')
-rw-r--r-- | activerecord/test/cases/helper.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 1a31c2ec4a..3d9328b198 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -119,15 +119,23 @@ def verify_default_timezone_config end end -def enable_uuid_ossp!(connection) +def enable_extension!(extension, connection) return false unless connection.supports_extensions? - return connection.reconnect! if connection.extension_enabled?('uuid-ossp') + return connection.reconnect! if connection.extension_enabled?(extension) - connection.enable_extension 'uuid-ossp' + connection.enable_extension extension connection.commit_db_transaction connection.reconnect! end +def disable_extension!(extension, connection) + return false unless connection.supports_extensions? + return true unless connection.extension_enabled?(extension) + + connection.disable_extension extension + connection.reconnect! +end + unless ENV['FIXTURE_DEBUG'] module ActiveRecord::TestFixtures::ClassMethods def try_to_load_dependency_with_silence(*args) |