@@ -13,30 +13,53 @@ def c.escaped_path(*parts)
13
13
Regexp . compile ( parts . join ( '[\\\/]' ) + '[\\\/]' )
14
14
end
15
15
16
- c . include RSpec ::Rails ::ControllerExampleGroup , :type => :controller , :example_group => {
17
- :file_path => c . escaped_path ( %w[ spec controllers ] )
18
- }
19
- c . include RSpec ::Rails ::HelperExampleGroup , :type => :helper , :example_group => {
20
- :file_path => c . escaped_path ( %w[ spec helpers ] )
21
- }
22
- if defined? ( RSpec ::Rails ::MailerExampleGroup )
23
- c . include RSpec ::Rails ::MailerExampleGroup , :type => :mailer , :example_group => {
24
- :file_path => c . escaped_path ( %w[ spec mailers ] )
16
+ c . include RSpec ::Rails ::ControllerExampleGroup ,
17
+ :type => :controller ,
18
+ :example_group => lambda { |example_group , metadata |
19
+ metadata [ :type ] . nil? && c . escaped_path ( %w[ spec controllers ] ) =~ example_group [ :file_path ]
20
+ }
21
+
22
+ c . include RSpec ::Rails ::HelperExampleGroup ,
23
+ :type => :helper ,
24
+ :example_group => lambda { |example_group , metadata |
25
+ metadata [ :type ] . nil? && c . escaped_path ( %w[ spec helpers ] ) =~ example_group [ :file_path ]
25
26
}
27
+
28
+ if defined? ( RSpec ::Rails ::MailerExampleGroup )
29
+ c . include RSpec ::Rails ::MailerExampleGroup ,
30
+ :type => :mailer ,
31
+ :example_group => lambda { |example_group , metadata |
32
+ metadata [ :type ] . nil? && c . escaped_path ( %w[ spec mailers ] ) =~ example_group [ :file_path ]
33
+ }
26
34
end
27
- c . include RSpec ::Rails ::ModelExampleGroup , :type => :model , :example_group => {
28
- :file_path => c . escaped_path ( %w[ spec models ] )
29
- }
30
- c . include RSpec ::Rails ::RequestExampleGroup , :type => :request , :example_group => {
31
- :file_path => c . escaped_path ( %w[ spec (requests|integration|api) ] )
32
- }
33
- c . include RSpec ::Rails ::RoutingExampleGroup , :type => :routing , :example_group => {
34
- :file_path => c . escaped_path ( %w[ spec routing ] )
35
- }
36
- c . include RSpec ::Rails ::ViewExampleGroup , :type => :view , :example_group => {
37
- :file_path => c . escaped_path ( %w[ spec views ] )
38
- }
39
- c . include RSpec ::Rails ::FeatureExampleGroup , :type => :feature , :example_group => {
40
- :file_path => c . escaped_path ( %w[ spec features ] )
41
- }
35
+
36
+ c . include RSpec ::Rails ::ModelExampleGroup ,
37
+ :type => :model ,
38
+ :example_group => lambda { |example_group , metadata |
39
+ metadata [ :type ] . nil? && c . escaped_path ( %w[ spec models ] ) =~ example_group [ :file_path ]
40
+ }
41
+
42
+ c . include RSpec ::Rails ::RequestExampleGroup ,
43
+ :type => :request ,
44
+ :example_group => lambda { |example_group , metadata |
45
+ metadata [ :type ] . nil? && c . escaped_path ( %w[ spec (requests|integration|api) ] ) =~ example_group [ :file_path ]
46
+ }
47
+
48
+ c . include RSpec ::Rails ::RoutingExampleGroup ,
49
+ :type => :routing ,
50
+ :example_group => lambda { |example_group , metadata |
51
+ metadata [ :type ] . nil? && c . escaped_path ( %w[ spec routing ] ) =~ example_group [ :file_path ]
52
+ }
53
+
54
+ c . include RSpec ::Rails ::ViewExampleGroup ,
55
+ :type => :view ,
56
+ :example_group => lambda { |example_group , metadata |
57
+ metadata [ :type ] . nil? && c . escaped_path ( %w[ spec views ] ) =~ example_group [ :file_path ]
58
+ }
59
+
60
+ c . include RSpec ::Rails ::FeatureExampleGroup ,
61
+ :type => :feature ,
62
+ :example_group => lambda { |example_group , metadata |
63
+ metadata [ :type ] . nil? && c . escaped_path ( %w[ spec features ] ) =~ example_group [ :file_path ]
64
+ }
42
65
end
0 commit comments