diff options
author | ecoologic <erikecoologic@gmail.com> | 2014-10-07 23:17:56 +1000 |
---|---|---|
committer | ecoologic <erikecoologic@gmail.com> | 2014-10-07 23:17:56 +1000 |
commit | 117f09c5d1eb600908001bb7b5ee353756e56456 (patch) | |
tree | 717d45020cf652840f90c09579692e30bf31237b /activerecord/test/cases/helper.rb | |
parent | 8caf16a281260fedb0677c85047469e99c48da94 (diff) | |
parent | 75780373af9a3ddd4cc1bda3d4dbfe6121102b2e (diff) | |
download | rails-117f09c5d1eb600908001bb7b5ee353756e56456.tar.gz rails-117f09c5d1eb600908001bb7b5ee353756e56456.tar.bz2 rails-117f09c5d1eb600908001bb7b5ee353756e56456.zip |
Merge remote-tracking branch 'origin/master' into guides-template-inheritance
Diffstat (limited to 'activerecord/test/cases/helper.rb')
-rw-r--r-- | activerecord/test/cases/helper.rb | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 209ef597db..be635aeef9 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -50,6 +50,10 @@ def mysql_56? ActiveRecord::Base.connection.send(:version).join(".") >= "5.6.0" end +def mysql_enforcing_gtid_consistency? + current_adapter?(:MysqlAdapter, :Mysql2Adapter) && 'ON' == ActiveRecord::Base.connection.show_variable('enforce_gtid_consistency') +end + def supports_savepoints? ActiveRecord::Base.connection.supports_savepoints? end @@ -115,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) @@ -204,3 +216,8 @@ module InTimeZone end require 'mocha/setup' # FIXME: stop using mocha + +# FIXME: we have tests that depend on run order, we should fix that and +# remove this method call. +require 'active_support/test_case' +ActiveSupport::TestCase.test_order = :sorted |