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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52713450b9629f0a0873e30a3c247513b46cde5e
4
- data.tar.gz: c233748d729d58c91424998b46ab5a015bca2116
3
+ metadata.gz: 66fbe57b380af966b736a53bfeeccf4c27600825
4
+ data.tar.gz: aebe5c80b8aac0abdcc4f13f8cade0ea801d4b56
5
5
  SHA512:
6
- metadata.gz: 01edbccf2c85beaa5973c08d2796de106e3e2405f52ab1895c39c43849f843daea8b8cb72e96aa0f761685dd57dd3ae54f8733be36468c42b18bb15103529ca0
7
- data.tar.gz: 6c9d1a3597b6ffe1eb4639776a02e3a246a89ac68d7942c888f01dd72ef4e1e8bc3afa0bc318e8268b124ed3057434543bd8e8b6903498d7cf419f2261129f59
6
+ metadata.gz: 8a64c5c7fc2014e3f6dc6cb530c9aaae53140c6eadcdf8df96ad82d77f6acd7ec94f4a40d815177e503380aa306f5ae4bda1e7b2812850684bfe3c7c36f0cc05
7
+ data.tar.gz: f5b7376fed952b708fca9747b2e2c0b13a065bd86e8185882b3845dbb27750fbded954007ea5541f9123dc07c04992febeb139343d0a2ed82c58745d3cdd726e
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source 'https://rubygems.org'
5
5
  # this file is only for quick tests
6
6
 
7
7
  # rails should be included before us
8
- gem 'rails', '4.0.13'
8
+ gem 'rails', '5.2.0.rc1'
9
9
  gem 'simplecov', require: false
10
10
 
11
11
  # for assets:
@@ -4,17 +4,21 @@ module RoutesCoverage
4
4
  @app = app
5
5
  end
6
6
 
7
- def call env
7
+ def call original_env
8
8
  # router changes env/request during recognition so need a copy:
9
- req = ::Rails.application.routes.request_class.new env.dup
10
- ::Rails.application.routes.router.recognize(req) do |route|
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(env)
37
+ @app.call(original_env)
34
38
  end
35
39
  end
36
40
  end
@@ -1,3 +1,3 @@
1
1
  module RoutesCoverage
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  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.2
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-02-02 00:00:00.000000000 Z
11
+ date: 2018-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler