File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ def make_request(url)
9595 def urls_for ( api_class )
9696 api_class . routes
9797 . map ( &:path )
98- . select { | e | e . include? ( 'doc' ) }
98+ . grep ( / #{ GrapeSwagger :: DocMethods . class_variable_get ( :@@mount_path ) } \( \. json \) $/ )
9999 . reject { |e | e . include? ( ':name' ) }
100100 . map { |e | format_path ( e ) }
101101 . 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
1414 namespace :otherItem do
1515 get '/'
1616 end
17+
18+ namespace :my_doc do
19+ get '/'
20+ end
1721 end
1822
1923 class Base < Grape ::API
@@ -115,7 +119,7 @@ class Base < Grape::API
115119 end
116120
117121 it 'returns complete doc' do
118- expect ( response [ 'paths' ] . length ) . to eql 2
122+ expect ( response [ 'paths' ] . length ) . to eql 3
119123 end
120124 end
121125 end
@@ -132,6 +136,16 @@ class Base < Grape::API
132136 end
133137 end
134138
139+
140+ describe '#urls_for' do
141+ require 'pry'
142+ describe 'match only the path to mount_path' do
143+ it do
144+ expect ( subject . send ( :urls_for , api_class ) ) . to match_array [ '/api/swagger_doc' ]
145+ end
146+ end
147+ end
148+
135149 describe '#file' do
136150 describe 'no store given' do
137151 it 'returns swagger_doc.json' do
You can’t perform that action at this time.
0 commit comments