aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/mysql2/connection_test.rb
diff options
context:
space:
mode:
authorMichael Pearson <mipearson@gmail.com>2012-05-05 17:11:33 +1000
committerMichael Pearson <mipearson@gmail.com>2012-05-05 18:53:45 +1000
commit7c4d3311332d8d6718f29c0f275325ef999d4734 (patch)
treeaeec545b3465021077fab8fa95cf68b311d5ea44 /activerecord/test/cases/adapters/mysql2/connection_test.rb
parent4b905606e33f0adba61c2032f0972623ba40e5e5 (diff)
downloadrails-7c4d3311332d8d6718f29c0f275325ef999d4734.tar.gz
rails-7c4d3311332d8d6718f29c0f275325ef999d4734.tar.bz2
rails-7c4d3311332d8d6718f29c0f275325ef999d4734.zip
Add config option, rdoc, tests for mysql(2) STRICT_ALL_TABLES mode.
Diffstat (limited to 'activerecord/test/cases/adapters/mysql2/connection_test.rb')
-rw-r--r--activerecord/test/cases/adapters/mysql2/connection_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/connection_test.rb b/activerecord/test/cases/adapters/mysql2/connection_test.rb
index 8e2b9ca9a5..684c7f5929 100644
--- a/activerecord/test/cases/adapters/mysql2/connection_test.rb
+++ b/activerecord/test/cases/adapters/mysql2/connection_test.rb
@@ -29,6 +29,22 @@ class MysqlConnectionTest < ActiveRecord::TestCase
assert @connection.active?
end
+ # TODO: Below is a straight up copy/paste from mysql/connection_test.rb
+ # I'm not sure what the correct way is to share these tests between
+ # adapters in minitest.
+ def test_mysql_default_in_strict_mode
+ result = @connection.exec_query "SELECT @@SESSION.sql_mode"
+ assert_equal [["STRICT_ALL_TABLES"]], result.rows
+ end
+
+ def test_mysql_strict_mode_disabled
+ 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
+ end
+ end
+
private
def run_without_connection