routes_coverage 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/Rakefile +1 -0
- data/compiled_assets/routes.css +6 -2
- data/compiled_assets/routes.js +0 -1
- 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/html.rb +1 -1
- data/lib/routes_coverage/formatters/html_views/route_group.erb +6 -8
- data/lib/routes_coverage/result.rb +1 -1
- data/lib/routes_coverage/version.rb +1 -1
- data/lib/routes_coverage.rb +22 -0
- 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: 026e5816e111dad871c8ec89b6f19de4ccde34dc
|
4
|
+
data.tar.gz: 42e3f410f9a0c1475e9e8e0b4be008787b7b8339
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 602ab554a4a5a164ecaa4b73ae4bcf5a801af5c6f47b05c833b274c5f4819e48f9bb6ed5e58de75725ca78f0a2cd1237c186f578108b41230726c45837bbb9d1
|
7
|
+
data.tar.gz: 57ff9b05890686d40b6f759e1663c9c72bd50cc8fa1537a58048879d8bfa87c7b18cd08f35518e26e06bbd70e4283ce064680585e9f84b45de72f351fee21d93
|
data/README.md
CHANGED
@@ -36,6 +36,7 @@ By default html report with no groupping is generated. If you need more funtiona
|
|
36
36
|
RSpec.configure do |config|
|
37
37
|
config.routes_coverage.perform_report = ENV['ROUTES_COVERAGE'] # only generate report if env var is set
|
38
38
|
|
39
|
+
config.routes_coverage.exclude_put_fallbacks = true # exclude non-hit PUT-requests where a matching PATCH exists
|
39
40
|
config.routes_coverage.exclude_patterns << %r{PATCH /reqs} # excludes all requests matching regex
|
40
41
|
config.routes_coverage.exclude_namespaces << 'somenamespace' # excludes /somenamespace/*
|
41
42
|
|
data/Rakefile
CHANGED
@@ -10,6 +10,7 @@ Rake::TestTask.new(:spec) do |t|
|
|
10
10
|
end
|
11
11
|
|
12
12
|
Rake::TestTask.new(:dummytest) do |t| t.pattern = 'spec/fixtures/dummy_test.rb' end
|
13
|
+
Rake::TestTask.new(:dummytest_html) do |t| t.pattern = 'spec/fixtures/dummy_html.rb' end
|
13
14
|
Rake::TestTask.new(:dummytest_full) do |t| t.pattern = 'spec/fixtures/dummy_test_full.rb' end
|
14
15
|
Rake::TestTask.new(:dummytest_filter) do |t| t.pattern = 'spec/fixtures/dummy_test_nsfilters.rb' end
|
15
16
|
Rake::TestTask.new(:dummytest_groups) do |t| t.pattern = 'spec/fixtures/dummy_test_groups.rb' end
|
data/compiled_assets/routes.css
CHANGED
@@ -280,6 +280,12 @@ abbr.timeago {
|
|
280
280
|
|
281
281
|
.route_list {
|
282
282
|
margin-bottom: 18px; }
|
283
|
+
.route_list tr td {
|
284
|
+
font-weight: bold; }
|
285
|
+
.route_list tr.cov td.verb, .route_list tr.cov td.path, .route_list tr.cov td.cont, .route_list tr.cov td.hits {
|
286
|
+
color: #090 !important; }
|
287
|
+
.route_list tr.uncov td.verb, .route_list tr.uncov td.path, .route_list tr.uncov td.cont, .route_list tr.uncov td.hits {
|
288
|
+
color: #900 !important; }
|
283
289
|
|
284
290
|
tr, td {
|
285
291
|
margin: 0;
|
@@ -294,8 +300,6 @@ th {
|
|
294
300
|
|
295
301
|
td {
|
296
302
|
padding: 4px 8px; }
|
297
|
-
td.strong {
|
298
|
-
font-weight: bold; }
|
299
303
|
|
300
304
|
tr.even td {
|
301
305
|
background: #efefef; }
|
data/compiled_assets/routes.js
CHANGED
@@ -26,24 +26,22 @@
|
|
26
26
|
<th>Verb</th>
|
27
27
|
<th>Path</th>
|
28
28
|
<th>Controller</th>
|
29
|
-
<th>Covered</th>
|
30
29
|
<th>Hits</th>
|
31
30
|
</tr>
|
32
31
|
</thead>
|
33
32
|
<tbody>
|
34
33
|
<% result.all_routes_with_hits.each do |route| %>
|
35
|
-
<tr>
|
36
|
-
<td class="
|
37
|
-
<td class="
|
38
|
-
<td class="
|
39
|
-
<td class="
|
34
|
+
<tr class="<%= hits_css_class route[:hits] %>">
|
35
|
+
<td class="name"><%= route[:name] %></td>
|
36
|
+
<td class="verb"><%= route[:verb] %></td>
|
37
|
+
<td class="path"><%= route[:path] %></td>
|
38
|
+
<td class="cont">
|
40
39
|
<% if route[:engine_name] %>
|
41
40
|
engine <%= route[:engine_name] %>
|
42
41
|
<% end %>
|
43
42
|
<%= route[:reqs] %>
|
44
43
|
</td>
|
45
|
-
<td class="
|
46
|
-
<td class="<%= hits_css_class route[:hits] %> strong"><%= route[:hits] %></td>
|
44
|
+
<td class="hits"><%= route[:hits] %></td>
|
47
45
|
</tr>
|
48
46
|
<% end %>
|
49
47
|
</tbody>
|
data/lib/routes_coverage.rb
CHANGED
@@ -21,6 +21,7 @@ module RoutesCoverage
|
|
21
21
|
class Settings
|
22
22
|
attr_reader :exclude_patterns
|
23
23
|
attr_reader :exclude_namespaces
|
24
|
+
attr_accessor :exclude_put_fallbacks
|
24
25
|
|
25
26
|
attr_accessor :perform_report
|
26
27
|
attr_accessor :minimum_coverage
|
@@ -33,6 +34,7 @@ module RoutesCoverage
|
|
33
34
|
def initialize
|
34
35
|
@exclude_patterns = []
|
35
36
|
@exclude_namespaces = []
|
37
|
+
@exclude_put_fallbacks = false
|
36
38
|
@minimum_coverage = 1
|
37
39
|
@round_precision = 1
|
38
40
|
@format = :html
|
@@ -84,6 +86,26 @@ module RoutesCoverage
|
|
84
86
|
all_routes.reject!{|r| r.app.is_a?(::Sprockets::Environment) }
|
85
87
|
end
|
86
88
|
|
89
|
+
if settings.exclude_put_fallbacks
|
90
|
+
all_routes.reject!{|put_route|
|
91
|
+
(
|
92
|
+
put_route.verb == /^PUT$/ ||
|
93
|
+
put_route.verb == "PUT" # rails 5
|
94
|
+
) &&
|
95
|
+
put_route.name.nil? &&
|
96
|
+
@@route_hit_count[put_route] == 0 &&
|
97
|
+
all_routes.any?{|patch_route|
|
98
|
+
(
|
99
|
+
patch_route.verb == /^PATCH$/ ||
|
100
|
+
patch_route.verb == "PATCH" # rails5
|
101
|
+
) &&
|
102
|
+
patch_route.defaults == put_route.defaults &&
|
103
|
+
patch_route.ip == put_route.ip &&
|
104
|
+
patch_route.path.spec.to_s == put_route.path.spec.to_s
|
105
|
+
}
|
106
|
+
}
|
107
|
+
end
|
108
|
+
|
87
109
|
all_result = Result.new(
|
88
110
|
all_routes,
|
89
111
|
@@route_hit_count,
|
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
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasily Fedoseyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|