routes_coverage 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/gemfiles/rails_40.gemfile.lock +1 -1
- data/gemfiles/rails_40_rspec.gemfile.lock +1 -1
- data/gemfiles/rails_40_simplecov.gemfile.lock +1 -1
- data/gemfiles/rails_42.gemfile.lock +1 -1
- data/gemfiles/rails_5.gemfile.lock +1 -1
- data/gemfiles/rails_51.gemfile.lock +1 -1
- data/lib/routes_coverage/formatters/full_text.rb +1 -1
- data/lib/routes_coverage/middleware.rb +16 -1
- data/lib/routes_coverage/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6aad5a94925c3cc12b598d2782a569d204ddba0b
|
4
|
+
data.tar.gz: e04b8251b3ea90b14d771fd08efb1f553ce34b39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88acd61825c9a1de178407cb2bdab1097667310d772a93a4074b3ae078cd9c6f6fa9d85872b90d9e3c56e05db3e55a0e9c060e498ad053673394ac5184b82f14
|
7
|
+
data.tar.gz: 181d4b8ae63084ed5c4238c09b5ab373e100854ffc3254365e7e94329ca436b41a59995e8574cefc99a37165a38fb063a96360b23fbba4f4b3cd7e6a24c9a21f
|
@@ -7,9 +7,24 @@ module RoutesCoverage
|
|
7
7
|
def call env
|
8
8
|
req = ::Rails.application.routes.request_class.new env
|
9
9
|
::Rails.application.routes.router.recognize(req) do |route|
|
10
|
+
dispatcher = route.app
|
11
|
+
if dispatcher.respond_to?(:dispatcher?)
|
12
|
+
dispatcher = nil unless dispatcher.matches?(req) && dispatcher.dispatcher?
|
13
|
+
else # rails < 4.2
|
14
|
+
dispatcher = route.app
|
15
|
+
while dispatcher.is_a?(ActionDispatch::Routing::Mapper::Constraints) do
|
16
|
+
if dispatcher.matches?(env)
|
17
|
+
dispatcher = dispatcher.app
|
18
|
+
else
|
19
|
+
dispatcher = nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
next unless dispatcher
|
24
|
+
|
10
25
|
RoutesCoverage._touch_route(route)
|
11
26
|
# there may be multiple matching routes - we should match only first
|
12
|
-
|
27
|
+
break
|
13
28
|
end
|
14
29
|
#TODO: detect 404s? and maybe other route errors?
|
15
30
|
@app.call(env)
|