@@ -45,15 +45,40 @@ class Configuration
45
45
#
46
46
# @api private
47
47
def self . add_test_type_configurations ( config )
48
- config . include RSpec ::Rails ::ControllerExampleGroup , type : :controller
49
- config . include RSpec ::Rails ::HelperExampleGroup , type : :helper
50
- config . include RSpec ::Rails ::ModelExampleGroup , type : :model
51
- config . include RSpec ::Rails ::RequestExampleGroup , type : :request
52
- config . include RSpec ::Rails ::RoutingExampleGroup , type : :routing
53
- config . include RSpec ::Rails ::ViewExampleGroup , type : :view
54
- config . include RSpec ::Rails ::FeatureExampleGroup , type : :feature
48
+ config . define_derived_metadata ( type : :controller ) do
49
+ config . include RSpec ::Rails ::ControllerExampleGroup , type : :controller
50
+ end
51
+
52
+ config . define_derived_metadata ( type : :helper ) do
53
+ config . include RSpec ::Rails ::HelperExampleGroup , type : :helper
54
+ end
55
+
56
+ config . define_derived_metadata ( type : :model ) do
57
+ config . include RSpec ::Rails ::ModelExampleGroup , type : :model
58
+ end
59
+
60
+ config . define_derived_metadata ( type : :request ) do
61
+ config . include RSpec ::Rails ::RequestExampleGroup , type : :request
62
+ end
63
+
64
+ config . define_derived_metadata ( type : :routing ) do
65
+ require "action_controller/test_case"
66
+ config . include RSpec ::Rails ::RoutingExampleGroup , type : :routing
67
+ end
68
+
69
+ config . define_derived_metadata ( type : :view ) do
70
+ config . include RSpec ::Rails ::ViewExampleGroup , type : :view
71
+ end
72
+
73
+ config . define_derived_metadata ( type : :feature ) do
74
+ config . include RSpec ::Rails ::FeatureExampleGroup , type : :feature
75
+ end
76
+
55
77
config . include RSpec ::Rails ::Matchers
56
- config . include RSpec ::Rails ::SystemExampleGroup , type : :system
78
+
79
+ config . define_derived_metadata ( type : :system ) do
80
+ config . include RSpec ::Rails ::SystemExampleGroup , type : :system
81
+ end
57
82
end
58
83
59
84
# @private
@@ -192,27 +217,38 @@ def fixture_path=(path)
192
217
193
218
if defined? ( ::Rails ::Controller ::Testing )
194
219
[ :controller , :view , :request ] . each do |type |
195
- config . include ::Rails ::Controller ::Testing ::TestProcess , type : type
196
- config . include ::Rails ::Controller ::Testing ::TemplateAssertions , type : type
197
- config . include ::Rails ::Controller ::Testing ::Integration , type : type
220
+ config . define_derived_metadata ( type : type ) do
221
+ config . include ::Rails ::Controller ::Testing ::TestProcess , type : type
222
+ config . include ::Rails ::Controller ::Testing ::TemplateAssertions , type : type
223
+ config . include ::Rails ::Controller ::Testing ::Integration , type : type
224
+ end
198
225
end
199
226
end
200
227
201
228
if RSpec ::Rails ::FeatureCheck . has_action_mailer?
202
- config . include RSpec ::Rails ::MailerExampleGroup , type : :mailer
229
+ config . define_derived_metadata ( type : :mailer ) do
230
+ config . include RSpec ::Rails ::MailerExampleGroup , type : :mailer
231
+ end
232
+
203
233
config . after { ActionMailer ::Base . deliveries . clear }
204
234
end
205
235
206
236
if RSpec ::Rails ::FeatureCheck . has_active_job?
207
- config . include RSpec ::Rails ::JobExampleGroup , type : :job
237
+ config . define_derived_metadata ( type : :job ) do
238
+ config . include RSpec ::Rails ::JobExampleGroup , type : :job
239
+ end
208
240
end
209
241
210
242
if RSpec ::Rails ::FeatureCheck . has_action_cable_testing?
211
- config . include RSpec ::Rails ::ChannelExampleGroup , type : :channel
243
+ config . define_derived_metadata ( type : :channel ) do
244
+ config . include RSpec ::Rails ::ChannelExampleGroup , type : :channel
245
+ end
212
246
end
213
247
214
248
if RSpec ::Rails ::FeatureCheck . has_action_mailbox?
215
- config . include RSpec ::Rails ::MailboxExampleGroup , type : :mailbox
249
+ config . define_derived_metadata ( type : :mailbox ) do
250
+ config . include RSpec ::Rails ::MailboxExampleGroup , type : :mailbox
251
+ end
216
252
end
217
253
end
218
254
0 commit comments