routes_coverage 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/routes_coverage/middleware.rb +8 -4
- data/lib/routes_coverage/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66fbe57b380af966b736a53bfeeccf4c27600825
|
4
|
+
data.tar.gz: aebe5c80b8aac0abdcc4f13f8cade0ea801d4b56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a64c5c7fc2014e3f6dc6cb530c9aaae53140c6eadcdf8df96ad82d77f6acd7ec94f4a40d815177e503380aa306f5ae4bda1e7b2812850684bfe3c7c36f0cc05
|
7
|
+
data.tar.gz: f5b7376fed952b708fca9747b2e2c0b13a065bd86e8185882b3845dbb27750fbded954007ea5541f9123dc07c04992febeb139343d0a2ed82c58745d3cdd726e
|
data/Gemfile
CHANGED
@@ -4,17 +4,21 @@ module RoutesCoverage
|
|
4
4
|
@app = app
|
5
5
|
end
|
6
6
|
|
7
|
-
def call
|
7
|
+
def call original_env
|
8
8
|
# router changes env/request during recognition so need a copy:
|
9
|
-
|
10
|
-
::Rails.application.routes.
|
9
|
+
env = original_env.dup
|
10
|
+
req = ::Rails.application.routes.request_class.new env
|
11
|
+
::Rails.application.routes.router.recognize(req) do |route, parameters5, parameters4|
|
12
|
+
parameters = parameters5 || parameters4
|
11
13
|
dispatcher = route.app
|
12
14
|
if dispatcher.respond_to?(:dispatcher?)
|
15
|
+
req.path_parameters = parameters
|
13
16
|
unless dispatcher.matches?(req) # && dispatcher.dispatcher?
|
14
17
|
dispatcher = nil
|
15
18
|
end
|
16
19
|
else # rails < 4.2
|
17
20
|
dispatcher = route.app
|
21
|
+
req.env['action_dispatch.request.path_parameters'] = (env['action_dispatch.request.path_parameters'] || {}).merge(parameters)
|
18
22
|
while dispatcher.is_a?(ActionDispatch::Routing::Mapper::Constraints) do
|
19
23
|
if dispatcher.matches?(env)
|
20
24
|
dispatcher = dispatcher.app
|
@@ -30,7 +34,7 @@ module RoutesCoverage
|
|
30
34
|
break
|
31
35
|
end
|
32
36
|
#TODO: detect 404s? and maybe other route errors?
|
33
|
-
@app.call(
|
37
|
+
@app.call(original_env)
|
34
38
|
end
|
35
39
|
end
|
36
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: routes_coverage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasily Fedoseyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|