diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-09-22 13:13:27 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-09-22 13:13:27 +0200 |
commit | 1165e9c898a17fadf8f91986ba2f25fb47651d53 (patch) | |
tree | fa4572c863ce7d5a6ddf7d7965b976a219ac40b9 | |
parent | 3931cec9cd3091ef4b8ee40066b896385d2085ea (diff) | |
download | rails-1165e9c898a17fadf8f91986ba2f25fb47651d53.tar.gz rails-1165e9c898a17fadf8f91986ba2f25fb47651d53.tar.bz2 rails-1165e9c898a17fadf8f91986ba2f25fb47651d53.zip |
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
```
-rw-r--r-- | activerecord/test/cases/adapters/mysql/explain_test.rb | 32 |
1 files changed, 13 insertions, 19 deletions
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 |