File tree Expand file tree Collapse file tree 2 files changed +40
-3
lines changed
lib/active_record/connection_adapters/abstract
test/cases/connection_adapters Expand file tree Collapse file tree 2 files changed +40
-3
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,10 @@ class NullPool # :nodoc:
26
26
27
27
attr_accessor :schema_cache
28
28
29
- def connection_klass
30
- nil
31
- end
29
+ def connection_klass ; end
30
+ def checkin ( _ ) ; end
31
+ def remove ( _ ) ; end
32
+ def async_executor ; end
32
33
end
33
34
34
35
# Connection pool base class for managing Active Record database
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require "cases/helper"
4
+ require "support/connection_helper"
5
+
6
+ module ActiveRecord
7
+ module ConnectionAdapters
8
+ class StandaloneConnectionTest < ActiveRecord ::TestCase
9
+ def setup
10
+ super
11
+
12
+ db_config = ActiveRecord ::Base . configurations . configs_for ( env_name : "arunit" , name : "primary" )
13
+ @connection = ActiveRecord ::Base . public_send ( db_config . adapter_method , db_config . configuration_hash )
14
+ end
15
+
16
+ def test_can_query
17
+ result = @connection . select_all ( "SELECT 1" )
18
+ assert_equal [ [ 1 ] ] , result . rows
19
+ end
20
+
21
+ def test_silently_ignore_async
22
+ result = @connection . select_all ( "SELECT 1" , async : true )
23
+ assert_equal [ [ 1 ] ] , result . rows
24
+ end
25
+
26
+ def test_can_throw_away
27
+ @connection . throw_away!
28
+ assert_not @connection . active?
29
+ end
30
+
31
+ def test_can_close
32
+ @connection . close
33
+ end
34
+ end
35
+ end
36
+ end
You can’t perform that action at this time.
0 commit comments