Skip to content

Commit 6397dc3

Browse files
committed
Allow route group matching by controller and action name
1 parent 88f3a91 commit 6397dc3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/routes_coverage.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ def self._collect_route_groups(all_routes)
137137
case key
138138
when :path
139139
route.path.spec.to_s =~ value
140+
when :action
141+
route.requirements[:action]&.match(value)
142+
when :controller
143+
route.requirements[:controller]&.match(value)
140144
when :constraints
141145
value.all? do |constraint_name, constraint_value|
142146
if constraint_value.present?

spec/fixtures/dummy_test_groups.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
config.groups["Some group"] = %r{^/somespace/}
88
config.groups["Foo"] = %r{^/reqs/}
99
config.groups["Subdomain"] = { constraints: { subdomain: 'subdomain' } }
10+
config.groups["Controller"] = { controller: 'dummy', action: /\Aupdat/ }
1011
end

0 commit comments

Comments
 (0)