diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-08-21 09:01:31 -0700 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-08-21 09:01:31 -0700 |
commit | 8c600e45cd78883680986c18ad400f859f6978b2 (patch) | |
tree | f6d4e2fb6c47b6fe8365c1b78f876dd50b8bfb14 /activerecord/test/cases | |
parent | 7e68e8bcc7dc314a8708209fcd457c1ef4516ac2 (diff) | |
parent | babc24c1b07c1fd58b9b3249b0256f9b0d45c0f0 (diff) | |
download | rails-8c600e45cd78883680986c18ad400f859f6978b2.tar.gz rails-8c600e45cd78883680986c18ad400f859f6978b2.tar.bz2 rails-8c600e45cd78883680986c18ad400f859f6978b2.zip |
Merge pull request #7408 from yahonda/sqlmode_mysql
Change mysql tests for strict mode disabled to work with new sql_mode default in MySQL 5.6.6-m9.
Since this MySQL version, the sql_mode default value is `NO_ENGINE_SUBSTITUTION`.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/adapters/mysql/connection_test.rb | 7 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/mysql2/connection_test.rb | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/activerecord/test/cases/adapters/mysql/connection_test.rb b/activerecord/test/cases/adapters/mysql/connection_test.rb index c3f82bc63d..4bccd2cc59 100644 --- a/activerecord/test/cases/adapters/mysql/connection_test.rb +++ b/activerecord/test/cases/adapters/mysql/connection_test.rb @@ -128,11 +128,12 @@ class MysqlConnectionTest < ActiveRecord::TestCase assert_equal [["STRICT_ALL_TABLES"]], result.rows end - def test_mysql_strict_mode_disabled + def test_mysql_strict_mode_disabled_dont_override_global_sql_mode run_without_connection do |orig_connection| ActiveRecord::Model.establish_connection(orig_connection.merge({:strict => false})) - result = ActiveRecord::Model.connection.exec_query "SELECT @@SESSION.sql_mode" - assert_equal [['']], result.rows + global_sql_mode = ActiveRecord::Model.connection.exec_query "SELECT @@GLOBAL.sql_mode" + session_sql_mode = ActiveRecord::Model.connection.exec_query "SELECT @@SESSION.sql_mode" + assert_equal global_sql_mode.rows, session_sql_mode.rows end end diff --git a/activerecord/test/cases/adapters/mysql2/connection_test.rb b/activerecord/test/cases/adapters/mysql2/connection_test.rb index 276c499276..c63e4fe5b6 100644 --- a/activerecord/test/cases/adapters/mysql2/connection_test.rb +++ b/activerecord/test/cases/adapters/mysql2/connection_test.rb @@ -44,11 +44,12 @@ class MysqlConnectionTest < ActiveRecord::TestCase assert_equal [["STRICT_ALL_TABLES"]], result.rows end - def test_mysql_strict_mode_disabled + def test_mysql_strict_mode_disabled_dont_override_global_sql_mode run_without_connection do |orig_connection| ActiveRecord::Model.establish_connection(orig_connection.merge({:strict => false})) - result = ActiveRecord::Model.connection.exec_query "SELECT @@SESSION.sql_mode" - assert_equal [['']], result.rows + global_sql_mode = ActiveRecord::Model.connection.exec_query "SELECT @@GLOBAL.sql_mode" + session_sql_mode = ActiveRecord::Model.connection.exec_query "SELECT @@SESSION.sql_mode" + assert_equal global_sql_mode.rows, session_sql_mode.rows end end |