File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ def make_request(url)
95
95
def urls_for ( api_class )
96
96
api_class . routes
97
97
. map ( &:path )
98
- . select { | e | e . include? ( 'doc' ) }
98
+ . grep ( / #{ GrapeSwagger :: DocMethods . class_variable_get ( :@@mount_path ) } / )
99
99
. reject { |e | e . include? ( ':name' ) }
100
100
. map { |e | format_path ( e ) }
101
101
. map { |e | [ e , ENV . fetch ( 'resource' , nil ) ] . join ( '/' ) . chomp ( '/' ) }
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ class Item < Grape::API
14
14
namespace :otherItem do
15
15
get '/'
16
16
end
17
+
18
+ namespace :my_doc do
19
+ get '/'
20
+ end
17
21
end
18
22
19
23
class Base < Grape ::API
@@ -115,7 +119,7 @@ class Base < Grape::API
115
119
end
116
120
117
121
it 'returns complete doc' do
118
- expect ( response [ 'paths' ] . length ) . to eql 2
122
+ expect ( response [ 'paths' ] . length ) . to eql 3
119
123
end
120
124
end
121
125
end
@@ -132,6 +136,14 @@ class Base < Grape::API
132
136
end
133
137
end
134
138
139
+ describe '#urls_for' do
140
+ describe 'match only the path to mount_path' do
141
+ it do
142
+ expect ( subject . send ( :urls_for , api_class ) ) . to match_array [ '/api/swagger_doc' ]
143
+ end
144
+ end
145
+ end
146
+
135
147
describe '#file' do
136
148
describe 'no store given' do
137
149
it 'returns swagger_doc.json' do
You can’t perform that action at this time.
0 commit comments