@@ -85,6 +85,52 @@ def app
85
85
get '/new_location'
86
86
expect ( last_response . body ) . to eq 'success'
87
87
end
88
+
89
+ context 'when the configuration is the value in a key-arg pair' do
90
+ subject ( :a_remounted_api ) do
91
+ Class . new ( Grape ::API ) do
92
+ version 'v1' , using : :param , parameter : configuration [ :version_param ]
93
+ get 'endpoint' do
94
+ 'version 1'
95
+ end
96
+
97
+ version 'v2' , using : :param , parameter : configuration [ :version_param ]
98
+ get 'endpoint' do
99
+ 'version 2'
100
+ end
101
+ end
102
+ end
103
+
104
+ it 'takes the param from the configuration' do
105
+ root_api . mount a_remounted_api , with : { version_param : 'param_name' }
106
+
107
+ get '/endpoint?param_name=v1'
108
+ expect ( last_response . body ) . to eq 'version 1'
109
+
110
+ get '/endpoint?param_name=v2'
111
+ expect ( last_response . body ) . to eq 'version 2'
112
+
113
+ get '/endpoint?wrong_param_name=v2'
114
+ expect ( last_response . body ) . to eq 'version 1'
115
+ end
116
+ end
117
+ end
118
+
119
+ context 'on the DescSCope' do
120
+ subject ( :a_remounted_api ) do
121
+ Class . new ( Grape ::API ) do
122
+ desc 'The description of this' do
123
+ tags [ 'not_configurable_tag' , configuration [ :a_configurable_tag ] ]
124
+ end
125
+ get 'location' do
126
+ 'success'
127
+ end
128
+ end
129
+ end
130
+
131
+ it 'mounts the endpoint with the appropiate tags' do
132
+ root_api . mount ( { a_remounted_api => 'integer' } , with : { a_configurable_tag : 'a configured tag' } )
133
+ end
88
134
end
89
135
90
136
context 'on the ParamScope' do
0 commit comments