routes_coverage 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dcc558504676f10b8f11d5c803288084c92b7c84
4
- data.tar.gz: 063d639635c7c5b3fbd17396f129882559541cfb
3
+ metadata.gz: 196f0c90f40628cebcdbb0eaf0589b417beb4cb0
4
+ data.tar.gz: 63355da36cb4e70ce4f49bfb546c5bd87b68000c
5
5
  SHA512:
6
- metadata.gz: d6dfb367c8a7f0487959ad3ef831cf057ef3a1ea3849583a89b0c52df259ffe58b27ad59a6ec03420d17bbd192f71fed14af2fdfe385de4298960f07db347060
7
- data.tar.gz: a5308eb14d95cb0afb8a95221fad4c5ac7f6ef3897d159680ede52d1b6db6e51b77268e52992fa3c0e27986746c1adb823d0bfe687b20fc4bd85e9a6ca769047
6
+ metadata.gz: 1a24baa38a0ca0d879d80c4cbae233d14c792956bf65f9dc5d6066a28730c5cc2607e4c40cf843d83d0be724065b5a9f8794d460e04c8a7a6a82e38c8182d408
7
+ data.tar.gz: 7a808aeb2315c8dcf08a9aa22f28e521b7163fe0c0c68525f295a0a83ffefc4a531a23f3d6618ae5bf70fdedc981bd37a8f69b85125b00a8b6b1cf9cfc2ceb1e
data/Gemfile CHANGED
@@ -6,5 +6,10 @@ source 'https://rubygems.org'
6
6
 
7
7
  # rails should be included before us
8
8
  gem 'rails', '4.0.13'
9
+ gem 'simplecov', require: false
10
+
11
+ # for assets:
12
+ gem 'sprockets'
13
+ gem 'sass'
9
14
 
10
15
  gemspec
data/README.md CHANGED
@@ -4,7 +4,8 @@
4
4
 
5
5
  Sometimes you need to know which routes are covered by your rails test suite.
6
6
 
7
- (more detailed readme coming soon)
7
+ ![Html output example](/assets/html_output_screenshot.png?raw=true "Html Output example")
8
+
8
9
 
9
10
  ## Installation
10
11
 
@@ -24,73 +25,30 @@ Or install it yourself as:
24
25
 
25
26
  ## Usage
26
27
 
27
- Install the gem and run your tests. By default you'll see something like:
28
-
29
- # Running tests:
30
-
31
- ....
32
-
33
- Finished tests in 0.037646s, 106.2530 tests/s, 106.2530 assertions/s.
34
-
35
- 4 tests, 4 assertions, 0 failures, 0 errors, 0 skips
36
- Routes coverage is 11.1% (1 of 9 routes hit at 1.0 hits average)
37
-
38
- To get more detailed information somewhere in your test helper add
39
-
40
- ```ruby
41
- RoutesCoverage.settings.format = :full_text
42
- ```
43
-
44
- or into RSpec config:
45
-
46
- ```ruby
47
- RSpec.configure do |config|
48
- config.routes_coverage.format = :full_text
49
- end
50
- ```
51
-
52
- Routes coverage is 11.1% (1 of 9 routes hit at 1.0 hits average)
53
- Coverage failed. Need at least 8
28
+ Install the gem and run your tests, then open generated report file `coverage/routes.html`.
54
29
 
55
- Covered routes:
56
- Verb URI Pattern Controller#Action Hits
57
- POST /reqs/current(.:format) dummy#current 1
58
-
59
- Pending routes:
60
- Verb URI Pattern Controller#Action
61
- GET /reqs(.:format) dummy#index
62
- POST /reqs(.:format) dummy#create
63
- GET /reqs/new(.:format) dummy#new
64
- GET /reqs/:id/edit(.:format) dummy#edit
65
- GET /reqs/:id(.:format) dummy#show
66
- PATCH /reqs/:id(.:format) dummy#update
67
- PUT /reqs/:id(.:format) dummy#update
68
- DELETE /reqs/:id(.:format) dummy#destroy
69
-
70
- ### Usage with SimpleCov
71
-
72
- Use `RoutesCoverage.settings.format = :simplecov_html` along with simplecov to generate a html report like this:
73
-
74
- ![Html output example](/assets/html_output_screenshot.png?raw=true "Html Output example")
75
-
76
- at the moment it shares styles with simplecov's one,
77
- code coverage report does not need to be generated each time as long as you have `/coverage` directory with all the resources.
78
30
 
79
31
  ### Configuration
80
32
 
81
- Set options in `RoutesCoverage.settings` or rspec's `config.routes_coverage`:
33
+ By default html report with no groupping is generated. If you need more funtionality - options in `RoutesCoverage.settings` or rspec's `config.routes_coverage`:
82
34
 
83
35
  ```ruby
84
36
  RSpec.configure do |config|
85
- config.routes_coverage.format = :full_text
86
37
  config.routes_coverage.exclude_patterns << %r{PATCH /reqs} # excludes all requests matching regex
87
38
  config.routes_coverage.exclude_namespaces << 'somenamespace' # excludes /somenamespace/*
39
+
40
+ config.groups["Some Route group title"] = %r{^/somespace/}
41
+ config.groups["Admin"] = %r{^/admin/}
42
+
43
+ config.routes_coverage.format = :html # html is default, others are :full_text and :summary_text, or your custom formatter class
44
+
88
45
  config.routes_coverage.minimum_coverage = 80 # %, your coverage goal
89
46
  config.routes_coverage.round_precision = 0 # just round to whole percents
90
47
  end
91
48
  ```
49
+ Excluded routes do not show in pending, but are shown if they're hit.
92
50
 
93
- or
51
+ If rspec is not your choice - use
94
52
 
95
53
  ```ruby
96
54
  RoutesCoverage.configure do |config|
@@ -99,8 +57,12 @@ RoutesCoverage.configure do |config|
99
57
  end
100
58
  ```
101
59
 
60
+ or
61
+
62
+ ```ruby
63
+ RoutesCoverage.settings.format = :full_text
64
+ ```
102
65
 
103
- Excluded routes do not show in pending, but are shown if they're hit.
104
66
 
105
67
 
106
68
  ## Development
data/Rakefile CHANGED
@@ -19,3 +19,17 @@ task :default => :spec
19
19
 
20
20
  $:.push File.expand_path("../lib", __FILE__)
21
21
  require 'routes_coverage/version'
22
+
23
+ namespace :assets do
24
+ desc "Compiles all assets"
25
+ task :compile do
26
+ puts "Compiling assets"
27
+ require "sprockets"
28
+ assets = Sprockets::Environment.new
29
+ assets.append_path "assets/javascripts"
30
+ assets.append_path "assets/stylesheets"
31
+ compiled_path = "compiled_assets"
32
+ assets["application.js"].write_to("#{compiled_path}/routes.js")
33
+ assets["application.css"].write_to("#{compiled_path}/routes.css")
34
+ end
35
+ end
@@ -0,0 +1,320 @@
1
+ /* -----------------------------------------------------------------------
2
+
3
+
4
+ Blueprint CSS Framework 0.9
5
+ http://blueprintcss.org
6
+
7
+ * Copyright (c) 2007-Present. See LICENSE for more info.
8
+ * See README for instructions on how to use Blueprint.
9
+ * For credits and origins, see AUTHORS.
10
+ * This is a compressed file. See the sources in the 'src' directory.
11
+
12
+ ----------------------------------------------------------------------- */
13
+
14
+ /* reset.css */
15
+
16
+ html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}
17
+ article, aside, dialog, figure, footer, header, hgroup, nav, section {display:block;}
18
+ body {line-height:1.5;}
19
+ table {border-collapse:separate;border-spacing:0;}
20
+ caption, th, td {text-align:left;font-weight:normal;}
21
+ table, td, th {vertical-align:middle;}
22
+ blockquote:before, blockquote:after, q:before, q:after {content:"";}
23
+ blockquote, q {quotes:"" "";}
24
+ a img {border:none;}
25
+
26
+ /* typography.css */
27
+ html {font-size:100.01%;}
28
+ body {font-size:82%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;}
29
+ h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;}
30
+ h1 {font-size:3em;line-height:1;margin-bottom:0.5em;}
31
+ h2 {font-size:2em;margin-bottom:0.75em;}
32
+ h3 {font-size:1.5em;line-height:1;margin-bottom:1em;}
33
+ h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;}
34
+ h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;}
35
+ h6 {font-size:1em;font-weight:bold;}
36
+ h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;}
37
+ p {margin:0 0 1.5em;}
38
+ p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;}
39
+ p img.right {float:right;margin:1.5em 0 1.5em 1.5em;}
40
+ a:focus, a:hover {color:#000;}
41
+ a {color:#009;text-decoration:underline;}
42
+ blockquote {margin:1.5em;color:#666;font-style:italic;}
43
+ strong {font-weight:bold;}
44
+ em, dfn {font-style:italic;}
45
+ dfn {font-weight:bold;}
46
+ sup, sub {line-height:0;}
47
+ abbr, acronym {border-bottom:1px dotted #666;}
48
+ address {margin:0 0 1.5em;font-style:italic;}
49
+ del {color:#666;}
50
+ pre {margin:1.5em 0;white-space:pre;}
51
+ pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;}
52
+ li ul, li ol {margin:0;}
53
+ ul, ol {margin:0 1.5em 1.5em 0;padding-left:3.333em;}
54
+ ul {list-style-type:disc;}
55
+ ol {list-style-type:decimal;}
56
+ dl {margin:0 0 1.5em 0;}
57
+ dl dt {font-weight:bold;}
58
+ dd {margin-left:1.5em;}
59
+ table {margin-bottom:1.4em;width:100%;}
60
+ th {font-weight:bold;}
61
+ thead th {background:#c3d9ff;}
62
+ th, td, caption {padding:4px 10px 4px 5px;}
63
+ tr.even td {background:#efefef;}
64
+ tfoot {font-style:italic;}
65
+ caption {background:#eee;}
66
+ .small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;}
67
+ .large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;}
68
+ .hide {display:none;}
69
+ .quiet {color:#666;}
70
+ .loud {color:#000;}
71
+ .highlight {background:#ff0;}
72
+ .added {background:#060;color:#fff;}
73
+ .removed {background:#900;color:#fff;}
74
+ .first {margin-left:0;padding-left:0;}
75
+ .last {margin-right:0;padding-right:0;}
76
+ .top {margin-top:0;padding-top:0;}
77
+ .bottom {margin-bottom:0;padding-bottom:0;}
78
+
79
+ /* forms.css */
80
+ label {font-weight:bold;}
81
+ fieldset {padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;}
82
+ legend {font-weight:bold;font-size:1.2em;}
83
+ input[type=text], input[type=password], input.text, input.title, textarea, select {background-color:#fff;border:1px solid #bbb;}
84
+ input[type=text]:focus, input[type=password]:focus, input.text:focus, input.title:focus, textarea:focus, select:focus {border-color:#666;}
85
+ input[type=text], input[type=password], input.text, input.title, textarea, select {margin:0.5em 0;}
86
+ input.text, input.title {width:300px;padding:5px;}
87
+ input.title {font-size:1.5em;}
88
+ textarea {width:390px;height:250px;padding:5px;}
89
+ input[type=checkbox], input[type=radio], input.checkbox, input.radio {position:relative;top:.25em;}
90
+ form.inline {line-height:3;}
91
+ form.inline p {margin-bottom:0;}
92
+ .error, .notice, .success {padding:.8em;margin-bottom:1em;border:2px solid #ddd;}
93
+ .error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;}
94
+ .notice {background:#FFF6BF;color:#514721;border-color:#FFD324;}
95
+ .success {background:#E6EFC2;color:#264409;border-color:#C6D880;}
96
+ .error a {color:#8a1f11;}
97
+ .notice a {color:#514721;}
98
+ .success a {color:#264409;}
99
+ .box {padding:1.5em;margin-bottom:1.5em;background:#E5ECF9;}
100
+ hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;margin:0 0 1.45em;border:none;}
101
+ hr.space {background:#fff;color:#fff;visibility:hidden;}
102
+ .clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;}
103
+ .clearfix, .container {display:block;}
104
+ .clear {clear:both;}
105
+ @charset "UTF-8";
106
+ .ui-icon {
107
+ display: block; }
108
+ .ui-icon.ui-icon-triangle-1-n:before {
109
+ content: "🔺"; }
110
+ .ui-icon.ui-icon-triangle-1-s:before {
111
+ content: "🔻"; }
112
+ .ui-icon.ui-icon-carat-1-n:before {
113
+ content: "△"; }
114
+ .ui-icon.ui-icon-carat-1-s:before {
115
+ content: "▽"; }
116
+ /*
117
+ * jQuery UI CSS Framework @VERSION
118
+ *
119
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
120
+ * Dual licensed under the MIT or GPL Version 2 licenses.
121
+ * http://jquery.org/license
122
+ *
123
+ * http://docs.jquery.com/UI/Theming/API
124
+ */
125
+
126
+ /* Layout helpers
127
+ ----------------------------------*/
128
+
129
+ .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
130
+ .ui-helper-clearfix { display: inline-block; }
131
+ /* required comment for clearfix to work in Opera \*/
132
+ * html .ui-helper-clearfix { height:1%; }
133
+ .ui-helper-clearfix { display:block; }
134
+ /* end clearfix */
135
+
136
+
137
+ /* Component containers
138
+ ----------------------------------*/
139
+ .ui-widget-header {
140
+ border: 1px solid #aaaaaa;
141
+ background: #cccccc;
142
+ /*TODO: gradient?*/
143
+ color: #222222; font-weight: bold;
144
+ }
145
+ .ui-widget-header a { color: #222222; }
146
+
147
+ /* Interaction states
148
+ ----------------------------------*/
149
+ .ui-state-default, .ui-widget-header .ui-state-default {
150
+ border: 1px solid #d3d3d3;
151
+ background: #e6e6e6;
152
+ /*TODO: gradient?*/
153
+ font-weight: normal; color: #555555;
154
+ }
155
+ .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
156
+
157
+ /* Interaction Cues
158
+ ----------------------------------*/
159
+ .ui-state-disabled { cursor: default !important; }
160
+ .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
161
+
162
+
163
+ /* Misc visuals
164
+ ----------------------------------*/
165
+
166
+ /* Corner radius */
167
+ .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; }
168
+ .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
169
+ .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
170
+ .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
171
+
172
+ /*
173
+ unused:
174
+ .ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
175
+ .ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
176
+ .ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
177
+ .ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
178
+ .ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
179
+ */
180
+ #loading {
181
+ position: fixed;
182
+ color: white;
183
+ left: 40%;
184
+ top: 50%; }
185
+
186
+ a {
187
+ color: #333;
188
+ text-decoration: none; }
189
+ a:hover {
190
+ color: #000;
191
+ text-decoration: underline; }
192
+
193
+ body {
194
+ font-family: "Lucida Grande", Helvetica, "Helvetica Neue", Arial, sans-serif;
195
+ padding: 12px;
196
+ background-color: #333; }
197
+
198
+ h1, h2, h3, h4 {
199
+ color: #1C2324;
200
+ margin: 0;
201
+ padding: 0;
202
+ margin-bottom: 12px; }
203
+
204
+ table {
205
+ width: 100%; }
206
+
207
+ #content {
208
+ clear: left;
209
+ background-color: white;
210
+ border: 2px solid #ddd;
211
+ border-top: 8px solid #ddd;
212
+ padding: 18px;
213
+ -webkit-border-bottom-left-radius: 5px;
214
+ -webkit-border-bottom-right-radius: 5px;
215
+ -webkit-border-top-right-radius: 5px;
216
+ -moz-border-radius-bottomleft: 5px;
217
+ -moz-border-radius-bottomright: 5px;
218
+ -moz-border-radius-topright: 5px;
219
+ border-bottom-left-radius: 5px;
220
+ border-bottom-right-radius: 5px;
221
+ border-top-right-radius: 5px; }
222
+
223
+ .dataTables_filter, .dataTables_info {
224
+ padding: 2px 6px; }
225
+
226
+ abbr.timeago {
227
+ text-decoration: none;
228
+ border: none;
229
+ font-weight: bold; }
230
+
231
+ .timestamp {
232
+ float: right;
233
+ color: #ddd; }
234
+
235
+ .group_tabs {
236
+ list-style: none;
237
+ float: left;
238
+ margin: 0;
239
+ padding: 0; }
240
+ .group_tabs li {
241
+ display: inline;
242
+ float: left; }
243
+ .group_tabs li a {
244
+ font-family: Helvetica, Arial, sans-serif;
245
+ display: block;
246
+ float: left;
247
+ text-decoration: none;
248
+ padding: 4px 8px;
249
+ background-color: #aaa;
250
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(#dddddd), to(#aaaaaa));
251
+ background: -moz-linear-gradient(#dddddd, #aaaaaa);
252
+ background: linear-gradient(#dddddd, #aaaaaa);
253
+ text-shadow: #e5e5e5 1px 1px 0px;
254
+ border-bottom: none;
255
+ color: #333;
256
+ font-weight: bold;
257
+ margin-right: 8px;
258
+ border-top: 1px solid #efefef;
259
+ -webkit-border-top-left-radius: 2px;
260
+ -webkit-border-top-right-radius: 2px;
261
+ -moz-border-radius-topleft: 2px;
262
+ -moz-border-radius-topright: 2px;
263
+ border-top-left-radius: 2px;
264
+ border-top-right-radius: 2px; }
265
+ .group_tabs li a:hover {
266
+ background-color: #ccc;
267
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(#eeeeee), to(#aaaaaa));
268
+ background: -moz-linear-gradient(#eeeeee, #aaaaaa);
269
+ background: linear-gradient(#eeeeee, #aaaaaa); }
270
+ .group_tabs li a:active {
271
+ padding-top: 5px;
272
+ padding-bottom: 3px; }
273
+ .group_tabs li.active a {
274
+ color: black;
275
+ text-shadow: #fff 1px 1px 0px;
276
+ background-color: #ddd;
277
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(white), to(#dddddd));
278
+ background: -moz-linear-gradient(white, #dddddd);
279
+ background: linear-gradient(white, #dddddd); }
280
+
281
+ .route_list {
282
+ margin-bottom: 18px; }
283
+
284
+ tr, td {
285
+ margin: 0;
286
+ padding: 0; }
287
+
288
+ th {
289
+ white-space: nowrap; }
290
+ th.ui-state-default {
291
+ cursor: pointer; }
292
+ th span.ui-icon {
293
+ float: left; }
294
+
295
+ td {
296
+ padding: 4px 8px; }
297
+ td.strong {
298
+ font-weight: bold; }
299
+
300
+ #footer {
301
+ color: #ddd;
302
+ font-size: 12px;
303
+ font-weight: bold;
304
+ margin-top: 12px;
305
+ text-align: right; }
306
+ #footer a {
307
+ color: #eee;
308
+ text-decoration: underline; }
309
+ #footer a:hover {
310
+ color: #fff;
311
+ text-decoration: none; }
312
+
313
+ .green {
314
+ color: #090; }
315
+
316
+ .red {
317
+ color: #900; }
318
+
319
+ .yellow {
320
+ color: #da0; }