1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases/adapters/mysql2
Jon Leighton 66982772b7 Fix broken mysql test
test_mysql_integer_not_null_defaults in test/cases/defaults_test.rb was
failing. This test relies on the connection being in strict mode. By
default a new connection is not in strict mode, but Active Record
automatically places it in strict mode.

ActiveSchemaTest overwrites the connection's #execute method in order to
prevent SQL statements from actually being executed. One of the
operations which is performed in ActiveSchema test is a #recreate_database.

Since 2088bf2798, recreate_database on
mysql or mysql2 will trigger a reconnect.

Due to the implementation of the hacking of #execute in
ActiveSchemaTest, this reconnect would take place, but the connection
would *not* be placed in strict mode because #execute had been
overridden to prevent SQL queries hitting the database.

Therefore, after ActiveSchemaTest, the connection would no longer be in
strict mode, causing test_mysql_integer_not_null_defaults to fail.

I don't think that the way that ActiveSchemaTest is implemented is
particularly nice or clean, but I have taken steps to make its hacks
more isolated - it now create a separate connection object which is
thrown away after the test, and the hacks are applied on the singleton
class of this object.
2013-05-03 11:36:02 +01:00
..
active_schema_test.rb Fix broken mysql test 2013-05-03 11:36:02 +01:00
bind_parameter_test.rb %s/find(:\(first\|last\|all\), \([^()]*\))/scoped(\2).\1/gcI amongst other things 2012-04-27 11:42:50 +01:00
case_sensitivity_test.rb ambiguous first argument; put parentheses or even spaces Warning removed! 2011-10-10 14:16:45 +05:30
connection_test.rb Connection#structure_dump is no longer used. #9518 2013-03-06 15:12:20 +01:00
enum_test.rb fix detect column type of enum 2013-04-01 17:09:20 +09:00
explain_test.rb add the query to AR::Relation#explain output 2011-11-25 14:29:34 -08:00
reserved_word_test.rb MOAR cleanups. 2013-03-14 10:47:13 +05:30
schema_migrations_test.rb sets limit 191 for schema_migrations#version in mysql2 if the encoding is "utf8mb4" 2013-03-17 20:29:58 +01:00
schema_test.rb Add support for FULLTEXT and SPATIAL indexes using the :type flag for MySQL. 2013-03-27 23:35:54 -04:00
sql_types_test.rb Use the MySQL varbinary type when appropriate in migrations. 2012-10-27 13:41:27 -04:00