routes_coverage 0.0.1 → 0.0.2

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: 29bd7e16ae5978198cfd1b76f2806ff6261199e9
4
- data.tar.gz: 87304e4e85b56a6030420d438b57ed8fb68aa635
3
+ metadata.gz: d0ca681a352b4b2c633a83b99cc7c5b4334e2e40
4
+ data.tar.gz: d3d3126f530afe3fff1978c801a5194247b24580
5
5
  SHA512:
6
- metadata.gz: dd7deaa57566e7eef61acb913199e39c3c0b14e5ea017054eb60f60b38901aac11ba57e772da71b6a9d64707f03e60179aa7f39e3386178401a6714411e93b0f
7
- data.tar.gz: 5932d5baf88b7e81267d6b8b8995dc865ff9134cea1bcebe20b201f6a49891bcc2dc6617a34a69366cf9cb82674cd15386f31ff9b21e81b0c198d88e17e7064d
6
+ metadata.gz: 9d1a5f0dff0432078c4f359f5feb98e0687a9bb778c9ec6b4fa8de40421eefd92c10b5b61f259556a2ee7be6b9aeefb0fd7286fee5f59a0e1ef56b20e1be61ac
7
+ data.tar.gz: 5fc59b5bfa01ec2a87c99fb861e67795cd33ebdc167bc03b3923ab50e2216bb6ca3f1b1733a18da5b8f56d3b9c36a5ebabd2469c3f96f56678f0b16d5278bd76
data/Appraisals ADDED
@@ -0,0 +1,23 @@
1
+ # to test against all, run: appraisal rake spec
2
+
3
+
4
+ appraise "rails-40" do
5
+ gem "rails", "~>4.0.0"
6
+ end
7
+
8
+ appraise "rails-42" do
9
+ gem "rails", "~>4.2.0"
10
+ end
11
+
12
+ appraise "rails-5" do
13
+ gem "rails", "~>5.0.0"
14
+ end
15
+
16
+ appraise "rails-40+rspec" do
17
+ gem "rails", "~>4.0.0"
18
+ gem "rspec-rails"
19
+ end
20
+
21
+ appraise "rails-51" do
22
+ gem "rails", "~>5.1.0"
23
+ end
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # RoutesCoverage
2
+ [![Gem Version](https://badge.fury.io/rb/routes_coverage.svg)](https://badge.fury.io/rb/routes_coverage)
3
+
2
4
 
3
5
  Sometimes you need to know which routes are covered by your rails test suite.
4
6
 
@@ -9,7 +11,7 @@ Sometimes you need to know which routes are covered by your rails test suite.
9
11
  Add this line to your application's Gemfile:
10
12
 
11
13
  ```ruby
12
- gem 'routes_coverage'
14
+ gem 'routes_coverage', group: :test
13
15
  ```
14
16
 
15
17
  And then execute:
@@ -22,7 +24,41 @@ Or install it yourself as:
22
24
 
23
25
  ## Usage
24
26
 
25
- Install the gem and run your tests.
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
+ Routes coverage is 11.1% (1 of 9 routes hit at 1.0 hits average)
45
+ Coverage failed. Need at least 8
46
+
47
+ Covered routes:
48
+ Verb URI Pattern Controller#Action Hits
49
+ POST /reqs/current(.:format) dummy#current 1
50
+
51
+ Pending routes:
52
+ Verb URI Pattern Controller#Action
53
+ GET /reqs(.:format) dummy#index
54
+ POST /reqs(.:format) dummy#create
55
+ GET /reqs/new(.:format) dummy#new
56
+ GET /reqs/:id/edit(.:format) dummy#edit
57
+ GET /reqs/:id(.:format) dummy#show
58
+ PATCH /reqs/:id(.:format) dummy#update
59
+ PUT /reqs/:id(.:format) dummy#update
60
+ DELETE /reqs/:id(.:format) dummy#destroy
61
+
26
62
 
27
63
  ## Development
28
64
 
@@ -30,6 +66,8 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
30
66
 
31
67
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
68
 
69
+ To run tests against different rails versions use `appraisal rake`
70
+
33
71
  ## Contributing
34
72
 
35
73
  Bug reports and pull requests are welcome on GitHub at https://github.com/Vasfed/routes_coverage.
data/Rakefile CHANGED
@@ -13,5 +13,3 @@ task :default => :spec
13
13
 
14
14
  $:.push File.expand_path("../lib", __FILE__)
15
15
  require 'routes_coverage/version'
16
-
17
- Bundler::GemHelper.install_tasks
data/bin/setup CHANGED
@@ -4,5 +4,4 @@ IFS=$'\n\t'
4
4
  set -vx
5
5
 
6
6
  bundle install
7
-
8
- # Do any other automated setup that you need to do here
7
+ appraisal
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~>4.0.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,89 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ routes_coverage (0.0.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actionmailer (4.0.13)
10
+ actionpack (= 4.0.13)
11
+ mail (~> 2.5, >= 2.5.4)
12
+ actionpack (4.0.13)
13
+ activesupport (= 4.0.13)
14
+ builder (~> 3.1.0)
15
+ erubis (~> 2.7.0)
16
+ rack (~> 1.5.2)
17
+ rack-test (~> 0.6.2)
18
+ activemodel (4.0.13)
19
+ activesupport (= 4.0.13)
20
+ builder (~> 3.1.0)
21
+ activerecord (4.0.13)
22
+ activemodel (= 4.0.13)
23
+ activerecord-deprecated_finders (~> 1.0.2)
24
+ activesupport (= 4.0.13)
25
+ arel (~> 4.0.0)
26
+ activerecord-deprecated_finders (1.0.4)
27
+ activesupport (4.0.13)
28
+ i18n (~> 0.6, >= 0.6.9)
29
+ minitest (~> 4.2)
30
+ multi_json (~> 1.3)
31
+ thread_safe (~> 0.1)
32
+ tzinfo (~> 0.3.37)
33
+ appraisal (2.1.0)
34
+ bundler
35
+ rake
36
+ thor (>= 0.14.0)
37
+ arel (4.0.2)
38
+ builder (3.1.4)
39
+ concurrent-ruby (1.0.5)
40
+ erubis (2.7.0)
41
+ i18n (0.8.1)
42
+ mail (2.6.5)
43
+ mime-types (>= 1.16, < 4)
44
+ mime-types (3.1)
45
+ mime-types-data (~> 3.2015)
46
+ mime-types-data (3.2016.0521)
47
+ minitest (4.7.5)
48
+ multi_json (1.12.1)
49
+ rack (1.5.5)
50
+ rack-test (0.6.3)
51
+ rack (>= 1.0)
52
+ rails (4.0.13)
53
+ actionmailer (= 4.0.13)
54
+ actionpack (= 4.0.13)
55
+ activerecord (= 4.0.13)
56
+ activesupport (= 4.0.13)
57
+ bundler (>= 1.3.0, < 2.0)
58
+ railties (= 4.0.13)
59
+ sprockets-rails (~> 2.0)
60
+ railties (4.0.13)
61
+ actionpack (= 4.0.13)
62
+ activesupport (= 4.0.13)
63
+ rake (>= 0.8.7)
64
+ thor (>= 0.18.1, < 2.0)
65
+ rake (10.5.0)
66
+ sprockets (3.7.1)
67
+ concurrent-ruby (~> 1.0)
68
+ rack (> 1, < 3)
69
+ sprockets-rails (2.3.3)
70
+ actionpack (>= 3.0)
71
+ activesupport (>= 3.0)
72
+ sprockets (>= 2.8, < 4.0)
73
+ thor (0.19.4)
74
+ thread_safe (0.3.6)
75
+ tzinfo (0.3.53)
76
+
77
+ PLATFORMS
78
+ ruby
79
+
80
+ DEPENDENCIES
81
+ appraisal
82
+ bundler (~> 1.14)
83
+ minitest
84
+ rails (~> 4.0.0)
85
+ rake (~> 10.0)
86
+ routes_coverage!
87
+
88
+ BUNDLED WITH
89
+ 1.14.6
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~>4.0.0"
6
+ gem "rspec-rails"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,108 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ routes_coverage (0.0.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actionmailer (4.0.13)
10
+ actionpack (= 4.0.13)
11
+ mail (~> 2.5, >= 2.5.4)
12
+ actionpack (4.0.13)
13
+ activesupport (= 4.0.13)
14
+ builder (~> 3.1.0)
15
+ erubis (~> 2.7.0)
16
+ rack (~> 1.5.2)
17
+ rack-test (~> 0.6.2)
18
+ activemodel (4.0.13)
19
+ activesupport (= 4.0.13)
20
+ builder (~> 3.1.0)
21
+ activerecord (4.0.13)
22
+ activemodel (= 4.0.13)
23
+ activerecord-deprecated_finders (~> 1.0.2)
24
+ activesupport (= 4.0.13)
25
+ arel (~> 4.0.0)
26
+ activerecord-deprecated_finders (1.0.4)
27
+ activesupport (4.0.13)
28
+ i18n (~> 0.6, >= 0.6.9)
29
+ minitest (~> 4.2)
30
+ multi_json (~> 1.3)
31
+ thread_safe (~> 0.1)
32
+ tzinfo (~> 0.3.37)
33
+ appraisal (2.2.0)
34
+ bundler
35
+ rake
36
+ thor (>= 0.14.0)
37
+ arel (4.0.2)
38
+ builder (3.1.4)
39
+ concurrent-ruby (1.0.5)
40
+ diff-lcs (1.2.5)
41
+ erubis (2.7.0)
42
+ i18n (0.8.1)
43
+ mail (2.6.5)
44
+ mime-types (>= 1.16, < 4)
45
+ mime-types (3.1)
46
+ mime-types-data (~> 3.2015)
47
+ mime-types-data (3.2016.0521)
48
+ minitest (4.7.5)
49
+ multi_json (1.12.1)
50
+ rack (1.5.5)
51
+ rack-test (0.6.3)
52
+ rack (>= 1.0)
53
+ rails (4.0.13)
54
+ actionmailer (= 4.0.13)
55
+ actionpack (= 4.0.13)
56
+ activerecord (= 4.0.13)
57
+ activesupport (= 4.0.13)
58
+ bundler (>= 1.3.0, < 2.0)
59
+ railties (= 4.0.13)
60
+ sprockets-rails (~> 2.0)
61
+ railties (4.0.13)
62
+ actionpack (= 4.0.13)
63
+ activesupport (= 4.0.13)
64
+ rake (>= 0.8.7)
65
+ thor (>= 0.18.1, < 2.0)
66
+ rake (10.5.0)
67
+ rspec-core (3.5.4)
68
+ rspec-support (~> 3.5.0)
69
+ rspec-expectations (3.5.0)
70
+ diff-lcs (>= 1.2.0, < 2.0)
71
+ rspec-support (~> 3.5.0)
72
+ rspec-mocks (3.5.0)
73
+ diff-lcs (>= 1.2.0, < 2.0)
74
+ rspec-support (~> 3.5.0)
75
+ rspec-rails (3.5.2)
76
+ actionpack (>= 3.0)
77
+ activesupport (>= 3.0)
78
+ railties (>= 3.0)
79
+ rspec-core (~> 3.5.0)
80
+ rspec-expectations (~> 3.5.0)
81
+ rspec-mocks (~> 3.5.0)
82
+ rspec-support (~> 3.5.0)
83
+ rspec-support (3.5.0)
84
+ sprockets (3.7.1)
85
+ concurrent-ruby (~> 1.0)
86
+ rack (> 1, < 3)
87
+ sprockets-rails (2.3.3)
88
+ actionpack (>= 3.0)
89
+ activesupport (>= 3.0)
90
+ sprockets (>= 2.8, < 4.0)
91
+ thor (0.19.4)
92
+ thread_safe (0.3.6)
93
+ tzinfo (0.3.53)
94
+
95
+ PLATFORMS
96
+ ruby
97
+
98
+ DEPENDENCIES
99
+ appraisal
100
+ bundler (~> 1.14)
101
+ minitest
102
+ rails (~> 4.0.0)
103
+ rake (~> 10.0)
104
+ routes_coverage!
105
+ rspec-rails
106
+
107
+ BUNDLED WITH
108
+ 1.14.6
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~>4.2.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,119 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ routes_coverage (0.0.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actionmailer (4.2.7.1)
10
+ actionpack (= 4.2.7.1)
11
+ actionview (= 4.2.7.1)
12
+ activejob (= 4.2.7.1)
13
+ mail (~> 2.5, >= 2.5.4)
14
+ rails-dom-testing (~> 1.0, >= 1.0.5)
15
+ actionpack (4.2.7.1)
16
+ actionview (= 4.2.7.1)
17
+ activesupport (= 4.2.7.1)
18
+ rack (~> 1.6)
19
+ rack-test (~> 0.6.2)
20
+ rails-dom-testing (~> 1.0, >= 1.0.5)
21
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
22
+ actionview (4.2.7.1)
23
+ activesupport (= 4.2.7.1)
24
+ builder (~> 3.1)
25
+ erubis (~> 2.7.0)
26
+ rails-dom-testing (~> 1.0, >= 1.0.5)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
+ activejob (4.2.7.1)
29
+ activesupport (= 4.2.7.1)
30
+ globalid (>= 0.3.0)
31
+ activemodel (4.2.7.1)
32
+ activesupport (= 4.2.7.1)
33
+ builder (~> 3.1)
34
+ activerecord (4.2.7.1)
35
+ activemodel (= 4.2.7.1)
36
+ activesupport (= 4.2.7.1)
37
+ arel (~> 6.0)
38
+ activesupport (4.2.7.1)
39
+ i18n (~> 0.7)
40
+ json (~> 1.7, >= 1.7.7)
41
+ minitest (~> 5.1)
42
+ thread_safe (~> 0.3, >= 0.3.4)
43
+ tzinfo (~> 1.1)
44
+ appraisal (2.1.0)
45
+ bundler
46
+ rake
47
+ thor (>= 0.14.0)
48
+ arel (6.0.3)
49
+ builder (3.2.3)
50
+ concurrent-ruby (1.0.5)
51
+ erubis (2.7.0)
52
+ globalid (0.3.7)
53
+ activesupport (>= 4.1.0)
54
+ i18n (0.8.1)
55
+ json (1.8.6)
56
+ loofah (2.0.3)
57
+ nokogiri (>= 1.5.9)
58
+ mail (2.6.5)
59
+ mime-types (>= 1.16, < 4)
60
+ mime-types (3.1)
61
+ mime-types-data (~> 3.2015)
62
+ mime-types-data (3.2016.0521)
63
+ mini_portile2 (2.1.0)
64
+ minitest (5.10.1)
65
+ nokogiri (1.6.8.1)
66
+ mini_portile2 (~> 2.1.0)
67
+ rack (1.6.4)
68
+ rack-test (0.6.3)
69
+ rack (>= 1.0)
70
+ rails (4.2.7.1)
71
+ actionmailer (= 4.2.7.1)
72
+ actionpack (= 4.2.7.1)
73
+ actionview (= 4.2.7.1)
74
+ activejob (= 4.2.7.1)
75
+ activemodel (= 4.2.7.1)
76
+ activerecord (= 4.2.7.1)
77
+ activesupport (= 4.2.7.1)
78
+ bundler (>= 1.3.0, < 2.0)
79
+ railties (= 4.2.7.1)
80
+ sprockets-rails
81
+ rails-deprecated_sanitizer (1.0.3)
82
+ activesupport (>= 4.2.0.alpha)
83
+ rails-dom-testing (1.0.7)
84
+ activesupport (>= 4.2.0.beta, < 5.0)
85
+ nokogiri (~> 1.6.0)
86
+ rails-deprecated_sanitizer (>= 1.0.1)
87
+ rails-html-sanitizer (1.0.3)
88
+ loofah (~> 2.0)
89
+ railties (4.2.7.1)
90
+ actionpack (= 4.2.7.1)
91
+ activesupport (= 4.2.7.1)
92
+ rake (>= 0.8.7)
93
+ thor (>= 0.18.1, < 2.0)
94
+ rake (10.5.0)
95
+ sprockets (3.7.1)
96
+ concurrent-ruby (~> 1.0)
97
+ rack (> 1, < 3)
98
+ sprockets-rails (3.2.0)
99
+ actionpack (>= 4.0)
100
+ activesupport (>= 4.0)
101
+ sprockets (>= 3.0.0)
102
+ thor (0.19.4)
103
+ thread_safe (0.3.6)
104
+ tzinfo (1.2.2)
105
+ thread_safe (~> 0.1)
106
+
107
+ PLATFORMS
108
+ ruby
109
+
110
+ DEPENDENCIES
111
+ appraisal
112
+ bundler (~> 1.14)
113
+ minitest
114
+ rails (~> 4.2.0)
115
+ rake (~> 10.0)
116
+ routes_coverage!
117
+
118
+ BUNDLED WITH
119
+ 1.14.6
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~>5.0.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,124 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ routes_coverage (0.0.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actioncable (5.0.2)
10
+ actionpack (= 5.0.2)
11
+ nio4r (>= 1.2, < 3.0)
12
+ websocket-driver (~> 0.6.1)
13
+ actionmailer (5.0.2)
14
+ actionpack (= 5.0.2)
15
+ actionview (= 5.0.2)
16
+ activejob (= 5.0.2)
17
+ mail (~> 2.5, >= 2.5.4)
18
+ rails-dom-testing (~> 2.0)
19
+ actionpack (5.0.2)
20
+ actionview (= 5.0.2)
21
+ activesupport (= 5.0.2)
22
+ rack (~> 2.0)
23
+ rack-test (~> 0.6.3)
24
+ rails-dom-testing (~> 2.0)
25
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
26
+ actionview (5.0.2)
27
+ activesupport (= 5.0.2)
28
+ builder (~> 3.1)
29
+ erubis (~> 2.7.0)
30
+ rails-dom-testing (~> 2.0)
31
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
32
+ activejob (5.0.2)
33
+ activesupport (= 5.0.2)
34
+ globalid (>= 0.3.6)
35
+ activemodel (5.0.2)
36
+ activesupport (= 5.0.2)
37
+ activerecord (5.0.2)
38
+ activemodel (= 5.0.2)
39
+ activesupport (= 5.0.2)
40
+ arel (~> 7.0)
41
+ activesupport (5.0.2)
42
+ concurrent-ruby (~> 1.0, >= 1.0.2)
43
+ i18n (~> 0.7)
44
+ minitest (~> 5.1)
45
+ tzinfo (~> 1.1)
46
+ appraisal (2.2.0)
47
+ bundler
48
+ rake
49
+ thor (>= 0.14.0)
50
+ arel (7.1.4)
51
+ builder (3.2.3)
52
+ concurrent-ruby (1.0.5)
53
+ erubis (2.7.0)
54
+ globalid (0.4.0)
55
+ activesupport (>= 4.2.0)
56
+ i18n (0.8.1)
57
+ loofah (2.0.3)
58
+ nokogiri (>= 1.5.9)
59
+ mail (2.6.5)
60
+ mime-types (>= 1.16, < 4)
61
+ method_source (0.8.2)
62
+ mime-types (3.1)
63
+ mime-types-data (~> 3.2015)
64
+ mime-types-data (3.2016.0521)
65
+ mini_portile2 (2.1.0)
66
+ minitest (5.10.2)
67
+ nio4r (2.0.0)
68
+ nokogiri (1.7.2)
69
+ mini_portile2 (~> 2.1.0)
70
+ rack (2.0.2)
71
+ rack-test (0.6.3)
72
+ rack (>= 1.0)
73
+ rails (5.0.2)
74
+ actioncable (= 5.0.2)
75
+ actionmailer (= 5.0.2)
76
+ actionpack (= 5.0.2)
77
+ actionview (= 5.0.2)
78
+ activejob (= 5.0.2)
79
+ activemodel (= 5.0.2)
80
+ activerecord (= 5.0.2)
81
+ activesupport (= 5.0.2)
82
+ bundler (>= 1.3.0, < 2.0)
83
+ railties (= 5.0.2)
84
+ sprockets-rails (>= 2.0.0)
85
+ rails-dom-testing (2.0.3)
86
+ activesupport (>= 4.2.0)
87
+ nokogiri (>= 1.6)
88
+ rails-html-sanitizer (1.0.3)
89
+ loofah (~> 2.0)
90
+ railties (5.0.2)
91
+ actionpack (= 5.0.2)
92
+ activesupport (= 5.0.2)
93
+ method_source
94
+ rake (>= 0.8.7)
95
+ thor (>= 0.18.1, < 2.0)
96
+ rake (10.5.0)
97
+ sprockets (3.7.1)
98
+ concurrent-ruby (~> 1.0)
99
+ rack (> 1, < 3)
100
+ sprockets-rails (3.2.0)
101
+ actionpack (>= 4.0)
102
+ activesupport (>= 4.0)
103
+ sprockets (>= 3.0.0)
104
+ thor (0.19.4)
105
+ thread_safe (0.3.6)
106
+ tzinfo (1.2.3)
107
+ thread_safe (~> 0.1)
108
+ websocket-driver (0.6.5)
109
+ websocket-extensions (>= 0.1.0)
110
+ websocket-extensions (0.1.2)
111
+
112
+ PLATFORMS
113
+ ruby
114
+
115
+ DEPENDENCIES
116
+ appraisal
117
+ bundler (~> 1.14)
118
+ minitest
119
+ rails (~> 5.0.0)
120
+ rake (~> 10.0)
121
+ routes_coverage!
122
+
123
+ BUNDLED WITH
124
+ 1.14.6
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~>5.1.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,124 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ routes_coverage (0.0.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actioncable (5.1.0)
10
+ actionpack (= 5.1.0)
11
+ nio4r (~> 2.0)
12
+ websocket-driver (~> 0.6.1)
13
+ actionmailer (5.1.0)
14
+ actionpack (= 5.1.0)
15
+ actionview (= 5.1.0)
16
+ activejob (= 5.1.0)
17
+ mail (~> 2.5, >= 2.5.4)
18
+ rails-dom-testing (~> 2.0)
19
+ actionpack (5.1.0)
20
+ actionview (= 5.1.0)
21
+ activesupport (= 5.1.0)
22
+ rack (~> 2.0)
23
+ rack-test (~> 0.6.3)
24
+ rails-dom-testing (~> 2.0)
25
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
26
+ actionview (5.1.0)
27
+ activesupport (= 5.1.0)
28
+ builder (~> 3.1)
29
+ erubi (~> 1.4)
30
+ rails-dom-testing (~> 2.0)
31
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
32
+ activejob (5.1.0)
33
+ activesupport (= 5.1.0)
34
+ globalid (>= 0.3.6)
35
+ activemodel (5.1.0)
36
+ activesupport (= 5.1.0)
37
+ activerecord (5.1.0)
38
+ activemodel (= 5.1.0)
39
+ activesupport (= 5.1.0)
40
+ arel (~> 8.0)
41
+ activesupport (5.1.0)
42
+ concurrent-ruby (~> 1.0, >= 1.0.2)
43
+ i18n (~> 0.7)
44
+ minitest (~> 5.1)
45
+ tzinfo (~> 1.1)
46
+ appraisal (2.2.0)
47
+ bundler
48
+ rake
49
+ thor (>= 0.14.0)
50
+ arel (8.0.0)
51
+ builder (3.2.3)
52
+ concurrent-ruby (1.0.5)
53
+ erubi (1.6.0)
54
+ globalid (0.4.0)
55
+ activesupport (>= 4.2.0)
56
+ i18n (0.8.1)
57
+ loofah (2.0.3)
58
+ nokogiri (>= 1.5.9)
59
+ mail (2.6.5)
60
+ mime-types (>= 1.16, < 4)
61
+ method_source (0.8.2)
62
+ mime-types (3.1)
63
+ mime-types-data (~> 3.2015)
64
+ mime-types-data (3.2016.0521)
65
+ mini_portile2 (2.1.0)
66
+ minitest (5.10.2)
67
+ nio4r (2.0.0)
68
+ nokogiri (1.7.2)
69
+ mini_portile2 (~> 2.1.0)
70
+ rack (2.0.2)
71
+ rack-test (0.6.3)
72
+ rack (>= 1.0)
73
+ rails (5.1.0)
74
+ actioncable (= 5.1.0)
75
+ actionmailer (= 5.1.0)
76
+ actionpack (= 5.1.0)
77
+ actionview (= 5.1.0)
78
+ activejob (= 5.1.0)
79
+ activemodel (= 5.1.0)
80
+ activerecord (= 5.1.0)
81
+ activesupport (= 5.1.0)
82
+ bundler (>= 1.3.0, < 2.0)
83
+ railties (= 5.1.0)
84
+ sprockets-rails (>= 2.0.0)
85
+ rails-dom-testing (2.0.3)
86
+ activesupport (>= 4.2.0)
87
+ nokogiri (>= 1.6)
88
+ rails-html-sanitizer (1.0.3)
89
+ loofah (~> 2.0)
90
+ railties (5.1.0)
91
+ actionpack (= 5.1.0)
92
+ activesupport (= 5.1.0)
93
+ method_source
94
+ rake (>= 0.8.7)
95
+ thor (>= 0.18.1, < 2.0)
96
+ rake (10.5.0)
97
+ sprockets (3.7.1)
98
+ concurrent-ruby (~> 1.0)
99
+ rack (> 1, < 3)
100
+ sprockets-rails (3.2.0)
101
+ actionpack (>= 4.0)
102
+ activesupport (>= 4.0)
103
+ sprockets (>= 3.0.0)
104
+ thor (0.19.4)
105
+ thread_safe (0.3.6)
106
+ tzinfo (1.2.3)
107
+ thread_safe (~> 0.1)
108
+ websocket-driver (0.6.5)
109
+ websocket-extensions (>= 0.1.0)
110
+ websocket-extensions (0.1.2)
111
+
112
+ PLATFORMS
113
+ ruby
114
+
115
+ DEPENDENCIES
116
+ appraisal
117
+ bundler (~> 1.14)
118
+ minitest
119
+ rails (~> 5.1.0)
120
+ rake (~> 10.0)
121
+ routes_coverage!
122
+
123
+ BUNDLED WITH
124
+ 1.14.6
@@ -10,64 +10,3 @@ RSpec.configure do |config|
10
10
  RoutesCoverage.perform_report
11
11
  end
12
12
  end
13
-
14
- # RSpec::RoutesCoverage.initialize_routes!
15
- #
16
- #
17
- # if ENV['LIST_ROUTES_COVERAGE']
18
- # # require 'action_dispatch/routing/inspector'
19
- #
20
- # format_routes = ->(routes){
21
- # formatter = ActionDispatch::Routing::ConsoleFormatter.new
22
- # ActionDispatch::Routing::RoutesInspector.new(routes).format(formatter)
23
- # }
24
- #
25
- # # inspector = begin
26
- # # require 'rails/application/route_inspector'
27
- # # Rails::Application::RouteInspector
28
- # # rescue LoadError
29
- # # require 'action_dispatch/routing/inspector'
30
- # # ActionDispatch::Routing::RoutesInspector
31
- # # end.new
32
- #
33
- # # inspector.instance_eval do
34
- # # def formatted_routes(routes)
35
- # # verb_width = routes.map{ |r| r[:verb].length }.max
36
- # # path_width = routes.map{ |r| r[:path].length }.max
37
- #
38
- # # routes.map do |r|
39
- # # "#{r[:verb].ljust(verb_width)} #{r[:path].ljust(path_width)} #{r[:reqs]}"
40
- # # end
41
- # # end
42
- # # end
43
- #
44
- #
45
- # legend = {
46
- # magenta: :excluded_routes,
47
- # green: :manually_tested_routes,
48
- # blue: :auto_tested_routes,
49
- # yellow: :pending_routes
50
- # }
51
- #
52
- # legend.each do |color, name|
53
- # total = name == :excluded_routes ? RSpec::RoutesCoverage.routes_num : RSpec::RoutesCoverage.tested_routes_num
54
- #
55
- # puts "\n\n"
56
- # puts "#{name.to_s.humanize} (#{RSpec::RoutesCoverage.send(name).length}/#{total})".send(color).bold
57
- # puts "\n"
58
- # # format_routes.call(RSpec::RoutesCoverage.send(name)).each do |route|
59
- # # puts ' ' + route.send(color)
60
- # # end
61
- # routes = RSpec::RoutesCoverage.send(name)
62
- # if routes.any?
63
- # puts format_routes.call(routes).send(color)
64
- # end
65
- # end
66
- # else
67
- # puts "\n\n"
68
- # puts 'Routes coverage stats:'
69
- # puts " Routes to test: #{RSpec::RoutesCoverage.tested_routes_num}/#{RSpec::RoutesCoverage.routes_num}".magenta
70
- # puts " Manually tested: #{RSpec::RoutesCoverage.manually_tested_routes.length}/#{RSpec::RoutesCoverage.tested_routes_num}".green
71
- # puts " Auto tested: #{RSpec::RoutesCoverage.auto_tested_routes.length}/#{RSpec::RoutesCoverage.tested_routes_num}".blue
72
- # print " Pending: #{RSpec::RoutesCoverage.pending_routes.length}/#{RSpec::RoutesCoverage.tested_routes_num}".yellow
73
- # end
@@ -1,10 +1,39 @@
1
+ require 'active_support/core_ext/string' # needed for rails5 version of inspector
1
2
  require 'action_dispatch/routing/inspector'
2
3
 
3
4
  module RoutesCoverage
4
5
  module Formatters
5
6
  class FullText < SummaryText
6
7
 
8
+ class Inspector < ActionDispatch::Routing::RoutesInspector
9
+ def collect_routes(routes)
10
+ routes.collect do |route|
11
+ ActionDispatch::Routing::RouteWrapper.new(route)
12
+ end.reject do |route|
13
+ route.internal?
14
+ end.collect do |route|
15
+ collect_engine_routes(route)
16
+
17
+ { name: route.name,
18
+ verb: route.verb,
19
+ path: route.path,
20
+ reqs: route.reqs,
21
+ # regexp: route.json_regexp, # removed, this is not present in rails5
22
+ original: route, # added
23
+ }
24
+ end
25
+ end
26
+ end
27
+
7
28
  class RouteFormatter < ActionDispatch::Routing::ConsoleFormatter
29
+
30
+ def initialize result=nil, _settings=nil, output_hits=false
31
+ @result = result
32
+ @output_hits = output_hits
33
+ @output_prefix = false
34
+ super()
35
+ end
36
+
8
37
  def no_routes
9
38
  @buffer << "\tNone"
10
39
  end
@@ -15,15 +44,22 @@ module RoutesCoverage
15
44
  header_lengths = HEADER.map(&:length)
16
45
  name_width, verb_width, path_width, reqs_width = widths(routes).zip(header_lengths).map(&:max)
17
46
 
47
+ hits = nil
18
48
  routes.map do |r|
19
- "#{r[:name].rjust(name_width)} #{r[:verb].ljust(verb_width)} #{r[:path].ljust(path_width)} #{r[:reqs].ljust(reqs_width)} ?"
49
+ # puts "route is #{r.inspect}"
50
+ if @output_hits
51
+ # hits = " ?"
52
+ original_route = r[:original].__getobj__ # SimpleDelegator
53
+ hits = " #{@result.route_hits[original_route]}"
54
+ end
55
+ "#{r[:name].rjust(name_width) if @output_prefix} #{r[:verb].ljust(verb_width)} #{r[:path].ljust(path_width)} #{r[:reqs].ljust(reqs_width)}#{hits}"
20
56
  end
21
57
  end
22
58
 
23
59
  def draw_header(routes)
24
60
  name_width, verb_width, path_width, reqs_width = widths(routes)
25
61
 
26
- "#{"Prefix".rjust(name_width)} #{"Verb".ljust(verb_width)} #{"URI Pattern".ljust(path_width)} #{"Controller#Action".ljust(reqs_width)} Hits"
62
+ "#{"Prefix".rjust(name_width) if @output_prefix} #{"Verb".ljust(verb_width)} #{"URI Pattern".ljust(path_width)} #{"Controller#Action".ljust(reqs_width)}#{' Hits' if @output_hits}"
27
63
  end
28
64
 
29
65
  def widths(routes)
@@ -47,10 +83,10 @@ module RoutesCoverage
47
83
  # routes.map do |r|
48
84
  # "#{r.verb.ljust(verb_width)} #{r.path.ljust(path_width)} #{r.reqs}"
49
85
  # end
50
- ActionDispatch::Routing::RoutesInspector.new(routes).format(RouteFormatter.new),
86
+ Inspector.new(routes).format(RouteFormatter.new(result, settings, true)),
51
87
  nil,
52
88
  "Pending routes:",
53
- ActionDispatch::Routing::RoutesInspector.new(result.pending_routes).format(RouteFormatter.new),
89
+ Inspector.new(result.pending_routes).format(RouteFormatter.new),
54
90
  ].flatten.join("\n")
55
91
  end
56
92
 
@@ -14,6 +14,7 @@ module RoutesCoverage
14
14
  end
15
15
 
16
16
  def status
17
+ return unless settings.minimum_coverage
17
18
  if result.coverage_pass?
18
19
  ""
19
20
  else
@@ -22,7 +23,7 @@ module RoutesCoverage
22
23
  end
23
24
 
24
25
  def format
25
- "Routes coverage is #{result.coverage}% (#{hits_count})#{status}"
26
+ "\nRoutes coverage is #{result.coverage}% (#{hits_count})#{status}"
26
27
  end
27
28
  end
28
29
  end
@@ -83,7 +83,7 @@ module RoutesCoverage
83
83
  end
84
84
 
85
85
  def coverage_pass?
86
- coverage >= RoutesCoverage.settings.minimum_coverage
86
+ !RoutesCoverage.settings.minimum_coverage || (coverage >= RoutesCoverage.settings.minimum_coverage)
87
87
  end
88
88
  end
89
89
  end
@@ -1,3 +1,3 @@
1
1
  module RoutesCoverage
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -17,11 +17,10 @@ Gem::Specification.new do |spec|
17
17
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
18
  f.match(%r{^(test|spec|features)/})
19
19
  end
20
- # spec.bindir = "exe"
21
- # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
20
  spec.require_paths = ["lib"]
23
21
 
24
22
  spec.add_development_dependency "bundler", "~> 1.14"
25
23
  spec.add_development_dependency "rake", "~> 10.0"
26
- # spec.add_development_dependency "minitest", "~> 4.0"
24
+ spec.add_development_dependency "minitest"
25
+ spec.add_development_dependency 'appraisal'
27
26
  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.0.1
4
+ version: 0.0.2
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 00:00:00.000000000 Z
11
+ date: 2017-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: appraisal
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  description: Generates coverage report for routes hit by your request/integration/feature
42
70
  tests including capybara ones
43
71
  email:
@@ -48,12 +76,23 @@ extra_rdoc_files: []
48
76
  files:
49
77
  - ".gitignore"
50
78
  - ".travis.yml"
79
+ - Appraisals
51
80
  - Gemfile
52
81
  - LICENSE.txt
53
82
  - README.md
54
83
  - Rakefile
55
84
  - bin/console
56
85
  - bin/setup
86
+ - gemfiles/rails_40.gemfile
87
+ - gemfiles/rails_40.gemfile.lock
88
+ - gemfiles/rails_40_rspec.gemfile
89
+ - gemfiles/rails_40_rspec.gemfile.lock
90
+ - gemfiles/rails_42.gemfile
91
+ - gemfiles/rails_42.gemfile.lock
92
+ - gemfiles/rails_5.gemfile
93
+ - gemfiles/rails_5.gemfile.lock
94
+ - gemfiles/rails_51.gemfile
95
+ - gemfiles/rails_51.gemfile.lock
57
96
  - lib/routes_coverage.rb
58
97
  - lib/routes_coverage/adapters/atexit.rb
59
98
  - lib/routes_coverage/adapters/rspec.rb