File tree Expand file tree Collapse file tree 6 files changed +48
-8
lines changed
cases/adapters/postgresql
railties/lib/rails/test_unit Expand file tree Collapse file tree 6 files changed +48
-8
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ if adapter_index
8
8
end
9
9
10
10
COMPONENT_ROOT = File . expand_path ( ".." , __dir__ )
11
- require_relative "../../tools/test "
11
+ require_relative "../test/support/tools "
12
12
13
13
module Minitest
14
14
def self . plugin_active_record_options ( opts , options )
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ class PostgresqlTime < ActiveRecord::Base
7
7
# Declare attributes to get rid from deprecation warnings on ActiveRecord 6.1
8
8
attribute :time_interval , :string
9
9
attribute :scaled_time_interval , :interval
10
- end if current_adapter? ( :PostgreSQLAdapter )
10
+ end
11
11
12
12
class PostgresqlOid < ActiveRecord ::Base
13
13
end
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class PostgresqlPoint < ActiveRecord::Base
16
16
attribute :legacy_x , :legacy_point
17
17
attribute :legacy_y , :legacy_point
18
18
attribute :legacy_z , :legacy_point
19
- end if current_adapter? ( :PostgreSQLAdapter )
19
+ end
20
20
21
21
def setup
22
22
@connection = ActiveRecord ::Base . connection
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ class IntervalDataType < ActiveRecord::Base
12
12
attribute :default_term , :interval
13
13
attribute :all_terms , :interval , array : true
14
14
attribute :legacy_term , :string
15
- end if current_adapter? ( :PostgreSQLAdapter )
15
+ end
16
16
17
17
class DeprecatedIntervalDataType < ActiveRecord ::Base ; end
18
18
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ $: << File . expand_path ( "test" , COMPONENT_ROOT )
4
+
5
+ require "bundler/setup"
6
+
7
+ require "rails/test_unit/runner"
8
+ require "rails/test_unit/reporter"
9
+ require "rails/test_unit/line_filtering"
10
+ require "active_support"
11
+ require "active_support/test_case"
12
+
13
+ require "rake/testtask"
14
+ Rails ::TestUnit ::Runner . singleton_class . prepend Module . new {
15
+ private
16
+ def list_tests ( argv )
17
+ tests = super
18
+ tests . concat FileList [ "test/cases/adapters/#{ adapter_name } /**/*_test.rb" ]
19
+ end
20
+
21
+ def default_test_exclude_glob
22
+ ENV [ "DEFAULT_TEST_EXCLUDE" ] || "test/cases/adapters/*/*_test.rb"
23
+ end
24
+
25
+ def adapter_name
26
+ ENV [ "ARCONN" ] || "sqlite3"
27
+ end
28
+ }
29
+
30
+ ActiveSupport ::TestCase . extend Rails ::LineFiltering
31
+ Rails ::TestUnitReporter . app_root = COMPONENT_ROOT
32
+ Rails ::TestUnitReporter . executable = "bin/test"
33
+
34
+ Rails ::TestUnit ::Runner . parse_options ( ARGV )
35
+ Rails ::TestUnit ::Runner . run ( ARGV )
Original file line number Diff line number Diff line change @@ -43,10 +43,7 @@ def run(argv = [])
43
43
end
44
44
45
45
def load_tests ( argv )
46
- patterns = extract_filters ( argv )
47
-
48
- tests = Rake ::FileList [ patterns . any? ? patterns : default_test_glob ]
49
- tests . exclude ( default_test_exclude_glob ) if patterns . empty?
46
+ tests = list_tests ( argv )
50
47
tests . to_a . each { |path | require File . expand_path ( path ) }
51
48
end
52
49
@@ -94,6 +91,14 @@ def regexp_filter?(arg)
94
91
def path_argument? ( arg )
95
92
%r"^[/\\ ]?\w +[/\\ ]" . match? ( arg )
96
93
end
94
+
95
+ def list_tests ( argv )
96
+ patterns = extract_filters ( argv )
97
+
98
+ tests = Rake ::FileList [ patterns . any? ? patterns : default_test_glob ]
99
+ tests . exclude ( default_test_exclude_glob ) if patterns . empty?
100
+ tests
101
+ end
97
102
end
98
103
end
99
104
You can’t perform that action at this time.
0 commit comments