Sha256: 08270c3c5ede08ad91747913c8dc4423ccc2a335530d8d7ec00ae633fc00b549

Contents?: true

Size: 992 Bytes

Versions: 4

Compression:

Stored size: 992 Bytes

Contents

require "cases/helper"
require 'models/developer'

module ActiveRecord
  module ConnectionAdapters
    class Mysql2Adapter
      class ExplainTest < ActiveRecord::TestCase
        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 %(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 %(developers | const), explain
          assert_match %(EXPLAIN for: SELECT `audit_logs`.* FROM `audit_logs`  WHERE `audit_logs`.`developer_id` IN (1)), explain
          assert_match %(audit_logs | ALL), explain
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activerecord-nuodb-adapter-2.0.3 test/cases/adapters/mysql2/explain_test.rb
activerecord-nuodb-adapter-2.0 test/cases/adapters/mysql2/explain_test.rb
activerecord-nuodb-adapter-1.1 test/cases/adapters/mysql2/explain_test.rb
activerecord-nuodb-adapter-1.0.4 test/cases/adapters/mysql2/explain_test.rb