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