@@ -5,47 +5,30 @@ module Rails
5
5
# @api public
6
6
# Container class for request spec functionality.
7
7
module SystemExampleGroup
8
- extend ActiveSupport ::Concern
9
- include RSpec ::Rails ::RailsExampleGroup
10
- include ActionDispatch ::Integration ::Runner
11
- include ActionDispatch ::Assertions
12
- include RSpec ::Rails ::Matchers ::RedirectTo
13
- include RSpec ::Rails ::Matchers ::RenderTemplate
14
- include ActionController ::TemplateAssertions
15
-
16
- include ActionDispatch ::IntegrationTest ::Behavior
17
-
18
- module BlowAwayAfterTeardownHook
19
- def after_teardown
20
- end
21
- end
8
+ # In rails system test inherits from integration test.
9
+ # RequestExampleGroup wraps that, so we just include it here
10
+ include RSpec ::Rails ::RequestExampleGroup
22
11
23
12
original_after_teardown = ::ActionDispatch ::SystemTesting ::TestHelpers ::SetupAndTeardown . instance_method ( :after_teardown )
24
13
25
- include ::ActionDispatch ::SystemTesting ::TestHelpers ::SetupAndTeardown
26
- include ::ActionDispatch ::SystemTesting ::TestHelpers ::ScreenshotHelper
27
- include BlowAwayAfterTeardownHook
28
-
29
- # for the SystemTesting Screenshot situation
30
- def passed?
31
- RSpec . current_example . exception . nil?
32
- end
33
-
14
+ module SystemTestHooks
15
+ include ::ActionDispatch ::SystemTesting ::TestHelpers ::SetupAndTeardown
16
+ include ::ActionDispatch ::SystemTesting ::TestHelpers ::ScreenshotHelper
17
+ # for the SystemTesting Screenshot situation
18
+ def passed?
19
+ RSpec . current_example . exception . nil?
20
+ end
34
21
35
- # Delegates to `Rails.application`.
36
- def app
37
- ::Rails . application
22
+ def after_teardown
23
+ end
38
24
end
25
+ include SystemTestHooks
39
26
40
27
included do
41
- def driven_by ( *args , &blk )
42
- @driver = ::ActionDispatch ::SystemTestCase . driven_by ( *args , &blk ) . tap { |d |
43
- d . use
44
- }
45
- end
28
+ attr_reader :driver
46
29
47
- def driver
48
- @driver
30
+ def driven_by ( * args , & blk )
31
+ @driver = :: ActionDispatch :: SystemTestCase . driven_by ( * args , & blk ) . tap ( & :use )
49
32
end
50
33
51
34
before do
@@ -56,10 +39,6 @@ def driver
56
39
after do
57
40
original_after_teardown . bind ( self ) . call
58
41
end
59
-
60
- around do |ex |
61
- ex . run
62
- end
63
42
end
64
43
end
65
44
end
0 commit comments