routes_revealer 2.2.0 → 2.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffa27ef9ffe75cd1d8a596b0b01d7f248df72b24
|
4
|
+
data.tar.gz: 51f4f34474c2fa44d9e1b92a684a21e140fe0444
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f7f2c87169a1b1e13d57de1b71cd46529baec427a936d57970cd8c7015e5610fe0899a5a4d78c1cba3f297c9a562e77745705b70ef3becce3fdb9fa67a45f0b
|
7
|
+
data.tar.gz: cf702ce31597e75615a72023ea496c508bfb37b20b27749c40ffd0c921ba5dfd1efc2ef6e5864d5a1cf1e35f95239c657c2efde4dbf5ffa1a578858bf780f417
|
@@ -46,8 +46,10 @@ module RoutesRevealer
|
|
46
46
|
def map_routes(routes, prepend='')
|
47
47
|
prepend = '' if prepend == '/'
|
48
48
|
route_hash_array(routes).map do |route_hash|
|
49
|
-
if route_hash[:reqs].include?("::Engine")
|
49
|
+
if route_hash[:reqs].is_a?(String) && route_hash[:reqs].include?("::Engine")
|
50
50
|
map_routes(Module.const_get(route_hash[:reqs]).routes.routes, route_hash[:path])
|
51
|
+
elsif route_hash[:reqs].is_a? Class
|
52
|
+
map_routes(route_hash[:reqs].routes.routes, route_hash[:path])
|
51
53
|
else
|
52
54
|
"#{prepend}#{route_hash[:path]}" unless ignore_route?(route_hash[:path])
|
53
55
|
end
|
@@ -10,10 +10,19 @@
|
|
10
10
|
# See the License for the specific language governing permissions and limitations under the License.
|
11
11
|
require 'spec_helper'
|
12
12
|
|
13
|
+
module Some
|
14
|
+
module Other
|
15
|
+
module Thing
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
13
21
|
describe RoutesRevealer::RoutesController do
|
14
22
|
describe '#index' do
|
15
23
|
let(:this_engine_string) { 'This::Engine' }
|
16
24
|
let(:that_engine_string) { 'That::Engine' }
|
25
|
+
let(:some_other_engine) { Some::Other::Thing }
|
17
26
|
|
18
27
|
let(:route1) { double('route1', path: '/1', verb: 'GET', reqs: 'controller#1') }
|
19
28
|
let(:route2) { double('route2', path: '/2', verb: 'POST', reqs: 'controller#2') }
|
@@ -21,6 +30,7 @@ describe RoutesRevealer::RoutesController do
|
|
21
30
|
let(:route4) { double('route4', path: '/4', verb: 'DELETE', reqs: 'controller#4') }
|
22
31
|
let(:route5) { double('route5', path: '/', verb: 'GET', reqs: this_engine_string) }
|
23
32
|
let(:route6) { double('route6', path: '/that', verb: 'GET', reqs: that_engine_string) }
|
33
|
+
let(:some_other_route) { double('other_route', path: '/other_route/1', verb: 'GET', reqs: some_other_engine) }
|
24
34
|
let(:bad_route7) { double('bad_route7', path: '/routes', verb: 'HEAD', reqs: 'controller#route7') }
|
25
35
|
let(:bad_route8) { double('bad_route7', path: '/rails', verb: 'TRACE', reqs: 'controller#route8') }
|
26
36
|
|
@@ -29,7 +39,8 @@ describe RoutesRevealer::RoutesController do
|
|
29
39
|
let(:that_route1) { double('that_route1', path: '/1', verb: 'SHOOTS', reqs: 'that_controller#1') }
|
30
40
|
let(:that_route2) { double('that_route2', path: '/2', verb: 'WALNUTS', reqs: 'that_controller#2') }
|
31
41
|
|
32
|
-
|
42
|
+
|
43
|
+
let(:routes) { [route1, route2, route3, route4, route5, route6, some_other_route, bad_route7, bad_route8] }
|
33
44
|
let(:this_routes) { [this_route1, this_route2] }
|
34
45
|
let(:that_routes) { [that_route1, that_route2] }
|
35
46
|
|
@@ -51,6 +62,7 @@ describe RoutesRevealer::RoutesController do
|
|
51
62
|
allow(route_wrapper).to receive(:new).with(route4).and_return(route4)
|
52
63
|
allow(route_wrapper).to receive(:new).with(route5).and_return(route5)
|
53
64
|
allow(route_wrapper).to receive(:new).with(route6).and_return(route6)
|
65
|
+
allow(route_wrapper).to receive(:new).with(some_other_route).and_return(some_other_route)
|
54
66
|
allow(route_wrapper).to receive(:new).with(bad_route7).and_return(bad_route7)
|
55
67
|
allow(route_wrapper).to receive(:new).with(bad_route8).and_return(bad_route8)
|
56
68
|
|
@@ -65,35 +77,36 @@ describe RoutesRevealer::RoutesController do
|
|
65
77
|
end
|
66
78
|
|
67
79
|
it { expect(response.status).to eq 200 }
|
68
|
-
it { expect(JSON.parse(response.body).length).to eq
|
80
|
+
it { expect(JSON.parse(response.body).length).to eq 11 }
|
69
81
|
it { expect(JSON.parse(response.body)[0]).to eq '/1' }
|
70
82
|
it { expect(JSON.parse(response.body)[1]).to eq '/2' }
|
71
83
|
it { expect(JSON.parse(response.body)[2]).to eq '/3' }
|
72
84
|
it { expect(JSON.parse(response.body)[3]).to eq '/4' }
|
73
85
|
it { expect(JSON.parse(response.body)[4]).to eq '/assets' }
|
74
|
-
it { expect(JSON.parse(response.body)[5]).to eq '/
|
75
|
-
it { expect(JSON.parse(response.body)[6]).to eq '/
|
76
|
-
it { expect(JSON.parse(response.body)[7]).to eq '/
|
77
|
-
it { expect(JSON.parse(response.body)[8]).to eq '/that/
|
78
|
-
it { expect(JSON.parse(response.body)[9]).to eq '/
|
86
|
+
it { expect(JSON.parse(response.body)[5]).to eq '/other_route/1' }
|
87
|
+
it { expect(JSON.parse(response.body)[6]).to eq '/t1' }
|
88
|
+
it { expect(JSON.parse(response.body)[7]).to eq '/t2' }
|
89
|
+
it { expect(JSON.parse(response.body)[8]).to eq '/that/1' }
|
90
|
+
it { expect(JSON.parse(response.body)[9]).to eq '/that/2' }
|
91
|
+
it { expect(JSON.parse(response.body)[10]).to eq '/zzz/public.txt' }
|
79
92
|
|
80
93
|
context 'Rails app includes a public folder' do
|
81
94
|
let(:public_folder) do
|
82
95
|
['public/robots.txt','public/humans.txt','public/dir/something.txt', 'public/assets/boom.png']
|
83
96
|
end
|
84
97
|
it 'adds the contents of the public folder' do
|
85
|
-
expect(JSON.parse(response.body).length).to eq
|
98
|
+
expect(JSON.parse(response.body).length).to eq 13
|
86
99
|
end
|
87
100
|
it { expect(JSON.parse(response.body)[5]).to eq '/dir/something.txt' }
|
88
101
|
it { expect(JSON.parse(response.body)[6]).to eq '/humans.txt' }
|
89
|
-
it { expect(JSON.parse(response.body)[
|
102
|
+
it { expect(JSON.parse(response.body)[8]).to eq '/robots.txt' }
|
90
103
|
end
|
91
104
|
|
92
105
|
context 'Rails app has an empty / non existant public folder' do
|
93
106
|
let(:public_folder) { [] }
|
94
107
|
|
95
108
|
it 'adds no additional entries' do
|
96
|
-
expect(JSON.parse(response.body).length).to eq
|
109
|
+
expect(JSON.parse(response.body).length).to eq 10
|
97
110
|
end
|
98
111
|
end
|
99
112
|
end
|
metadata
CHANGED
@@ -1,145 +1,145 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: routes_revealer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The CareerBuilder.com Consumer Development teams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 4.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sqlite3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: binding_of_caller
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: better_errors
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '1.1'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.1'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: codeclimate-test-reporter
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: webmock
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '1.21'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '1.21'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: simplecov
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0.7'
|
132
|
-
- -
|
132
|
+
- - ">="
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: 0.7.1
|
135
135
|
type: :development
|
136
136
|
prerelease: false
|
137
137
|
version_requirements: !ruby/object:Gem::Requirement
|
138
138
|
requirements:
|
139
|
-
- - ~>
|
139
|
+
- - "~>"
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0.7'
|
142
|
-
- -
|
142
|
+
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: 0.7.1
|
145
145
|
description: The /routes route will list all of the consuming application's routes
|
@@ -171,22 +171,22 @@ require_paths:
|
|
171
171
|
- lib
|
172
172
|
required_ruby_version: !ruby/object:Gem::Requirement
|
173
173
|
requirements:
|
174
|
-
- -
|
174
|
+
- - ">="
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: '0'
|
177
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
179
|
-
- -
|
179
|
+
- - ">="
|
180
180
|
- !ruby/object:Gem::Version
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
183
183
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.5.1
|
185
185
|
signing_key:
|
186
186
|
specification_version: 4
|
187
187
|
summary: Provides the route /routes which will list the applications routes
|
188
188
|
test_files:
|
189
189
|
- spec/config/initializers/response_injections_spec.rb
|
190
|
-
- spec/controllers/routes_controller_spec.rb
|
191
|
-
- spec/spec_helper.rb
|
192
190
|
- spec/support/helpers/controller_helpers.rb
|
191
|
+
- spec/spec_helper.rb
|
192
|
+
- spec/controllers/routes_controller_spec.rb
|