From 1165e9c898a17fadf8f91986ba2f25fb47651d53 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Tue, 22 Sep 2015 13:13:27 +0200 Subject: fix `bin/test -a sqlite3_mem`. We should not run MysqlAdapter tests when running with `sqlite3_mem`. This also moves the test-case outside the MysqlAdapter namespace. This will prevent the following error when running everything: ``` 1) Error: TestAdapterWithInvalidConnection#test_inspect_on_Model_class_does_not_raise: TypeError: superclass mismatch for class MysqlAdapter ``` --- .../test/cases/adapters/mysql/explain_test.rb | 32 +++++++++------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/adapters/mysql/explain_test.rb b/activerecord/test/cases/adapters/mysql/explain_test.rb index f75386abb9..c44c1e6648 100644 --- a/activerecord/test/cases/adapters/mysql/explain_test.rb +++ b/activerecord/test/cases/adapters/mysql/explain_test.rb @@ -2,26 +2,20 @@ require "cases/helper" require 'models/developer' require 'models/computer' -module ActiveRecord - module ConnectionAdapters - class MysqlAdapter - class ExplainTest < ActiveRecord::TestCase - fixtures :developers +class MysqlExplainTest < ActiveRecord::MysqlTestCase + fixtures :developers - def test_explain_for_one_query - explain = Developer.where(:id => 1).explain - assert_match %(EXPLAIN for: SELECT `developers`.* FROM `developers` WHERE `developers`.`id` = 1), explain - assert_match %r(developers |.* const), explain - end + def test_explain_for_one_query + explain = Developer.where(id: 1).explain + assert_match %(EXPLAIN for: SELECT `developers`.* FROM `developers` WHERE `developers`.`id` = 1), explain + assert_match %r(developers |.* const), explain + end - def test_explain_with_eager_loading - explain = Developer.where(:id => 1).includes(:audit_logs).explain - assert_match %(EXPLAIN for: SELECT `developers`.* FROM `developers` WHERE `developers`.`id` = 1), explain - assert_match %r(developers |.* const), explain - assert_match %(EXPLAIN for: SELECT `audit_logs`.* FROM `audit_logs` WHERE `audit_logs`.`developer_id` = 1), explain - assert_match %r(audit_logs |.* ALL), explain - end - end - end + def test_explain_with_eager_loading + explain = Developer.where(id: 1).includes(:audit_logs).explain + assert_match %(EXPLAIN for: SELECT `developers`.* FROM `developers` WHERE `developers`.`id` = 1), explain + assert_match %r(developers |.* const), explain + assert_match %(EXPLAIN for: SELECT `audit_logs`.* FROM `audit_logs` WHERE `audit_logs`.`developer_id` = 1), explain + assert_match %r(audit_logs |.* ALL), explain end end -- cgit v1.2.3