File tree Expand file tree Collapse file tree 8 files changed +31
-40
lines changed Expand file tree Collapse file tree 8 files changed +31
-40
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -380,11 +380,6 @@ class Railtie < Rails::Railtie # :nodoc:
380
380
app . reloader . before_class_unload { ActiveRecord ::QueryLogs . clear_context }
381
381
app . executor . to_run { ActiveRecord ::QueryLogs . clear_context }
382
382
app . executor . to_complete { ActiveRecord ::QueryLogs . clear_context }
383
-
384
- ActiveSupport . on_load ( :active_support_test_case ) do
385
- require "active_record/query_logs/test_helper"
386
- include ActiveRecord ::QueryLogs ::TestHelper
387
- end
388
383
end
389
384
end
390
385
end
Original file line number Diff line number Diff line change 2
2
3
3
require "cases/helper"
4
4
require "models/dashboard"
5
- require "active_record/query_logs/test_helper"
6
5
7
6
class QueryLogsTest < ActiveRecord ::TestCase
8
- # Automatically included in Rails apps via railtie but that don't run here.
9
- include ActiveRecord ::QueryLogs ::TestHelper
10
-
11
7
fixtures :dashboards
12
8
13
9
ActiveRecord ::QueryLogs . taggings [ :application ] = -> {
14
10
"active_record"
15
11
}
16
12
17
13
def setup
14
+ # QueryLogs context is automatically reset in Rails app via an executor hooks set in railtie
15
+ # But not in Active Record's own test suite.
16
+ ActiveRecord ::QueryLogs . clear_context
17
+
18
18
# Enable the query tags logging
19
19
@original_transformers = ActiveRecord . query_transformers
20
20
@original_prepend = ActiveRecord ::QueryLogs . prepend_comment
@@ -28,6 +28,9 @@ def teardown
28
28
ActiveRecord . query_transformers = @original_transformers
29
29
ActiveRecord ::QueryLogs . prepend_comment = @original_prepend
30
30
ActiveRecord ::QueryLogs . tags = [ ]
31
+ # QueryLogs context is automatically reset in Rails app via an executor hooks set in railtie
32
+ # But not in Active Record's own test suite.
33
+ ActiveRecord ::QueryLogs . clear_context
31
34
end
32
35
33
36
def test_escaping_good_comment
Original file line number Diff line number Diff line change
1
+ * ` Rails.application.executor ` hooks are now called around every tests.
2
+
3
+ This helps to better simulate request or job local state being reset.
4
+
5
+ * Jean Boussier*
6
+
1
7
* Fix the ` Digest::UUID.uuid_from_hash ` behavior for namespace IDs that are different from the ones defined on ` Digest::UUID ` .
2
8
3
9
The new behavior will be enabled by setting the
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveSupport ::Executor ::TestHelper # :nodoc:
4
+ def run ( ...)
5
+ Rails . application . executor . wrap { super }
6
+ end
7
+ end
Original file line number Diff line number Diff line change @@ -33,8 +33,8 @@ class Railtie < Rails::Railtie # :nodoc:
33
33
app . executor . to_complete { ActiveSupport ::CurrentAttributes . reset_all }
34
34
35
35
ActiveSupport . on_load ( :active_support_test_case ) do
36
- require "active_support/current_attributes /test_helper"
37
- include ActiveSupport ::CurrentAttributes ::TestHelper
36
+ require "active_support/executor /test_helper"
37
+ include ActiveSupport ::Executor ::TestHelper
38
38
end
39
39
end
40
40
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
require_relative "abstract_unit"
4
- require "active_support/current_attributes/test_helper"
5
4
6
5
class CurrentAttributesTest < ActiveSupport ::TestCase
7
- # Automatically included in Rails apps via railtie but that don't run here.
8
- include ActiveSupport ::CurrentAttributes ::TestHelper
6
+ # CurrentAttributes is automatically reset in Rails app via executor hooks set in railtie
7
+ # But not in Active Support's own test suite.
8
+ setup do
9
+ ActiveSupport ::CurrentAttributes . reset_all
10
+ end
11
+
12
+ teardown do
13
+ ActiveSupport ::CurrentAttributes . reset_all
14
+ end
9
15
10
16
Person = Struct . new ( :id , :name , :time_zone )
11
17
You can’t perform that action at this time.
0 commit comments