File tree Expand file tree Collapse file tree 4 files changed +18
-7
lines changed Expand file tree Collapse file tree 4 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ Metrics/AbcSize:
34
34
# Offense count: 282
35
35
# Configuration parameters: CountComments, ExcludedMethods.
36
36
Metrics/BlockLength :
37
- Max : 3117
37
+ Max : 3125
38
38
39
39
# Offense count: 9
40
40
# Configuration parameters: CountComments.
Original file line number Diff line number Diff line change 14
14
* [ #1724 ] ( https://github.com/ruby-grape/grape/pull/1724 ) : Optional nested array validation - [ @ericproulx ] ( https://github.com/ericproulx ) .
15
15
* [ #1725 ] ( https://github.com/ruby-grape/grape/pull/1725 ) : Fix ` rescue_from :all ` documentation - [ @Jelkster ] ( https://github.com/Jelkster ) .
16
16
* [ #1726 ] ( https://github.com/ruby-grape/grape/pull/1726 ) : Improved startup performance during API method generation - [ @jkowens ] ( https://github.com/jkowens ) .
17
+ * [ #1727 ] ( https://github.com/ruby-grape/grape/pull/1727 ) : Fix infinite loop when mounting endpoint with same superclass - [ @jkowens ] ( https://github.com/jkowens ) .
17
18
* Your contribution here.
18
19
19
20
### 1.0.1 (9/8/2017)
Original file line number Diff line number Diff line change @@ -165,13 +165,13 @@ def within_namespace(&_block)
165
165
166
166
private
167
167
168
- # Builds the current class :inheritable_setting. If available, it returns the superclass's :inheritable_setting.
169
- # Otherwise, a clean :inheritable_setting is returned .
168
+ # Builds the current class :inheritable_setting. If available, it inherits from
169
+ # the superclass's :inheritable_setting.
170
170
def build_top_level_setting
171
- if defined? ( superclass ) && superclass . respond_to? ( :inheritable_setting ) && superclass != Grape ::API
172
- superclass . inheritable_setting
173
- else
174
- Grape :: Util :: InheritableSetting . new
171
+ Grape ::Util :: InheritableSetting . new . tap do | setting |
172
+ if defined? ( superclass ) && superclass . respond_to? ( : inheritable_setting) && superclass != Grape :: API
173
+ setting . inherit_from superclass . inheritable_setting
174
+ end
175
175
end
176
176
end
177
177
end
Original file line number Diff line number Diff line change @@ -3129,6 +3129,16 @@ def static
3129
3129
get '/two/v1/world'
3130
3130
expect ( last_response . status ) . to eq 200
3131
3131
end
3132
+
3133
+ context 'when mounting class extends a subclass of Grape::API' do
3134
+ it 'mounts APIs with the same superclass' do
3135
+ base_api = Class . new ( Grape ::API )
3136
+ a = Class . new ( base_api )
3137
+ b = Class . new ( base_api )
3138
+
3139
+ expect { a . mount b } . to_not raise_error
3140
+ end
3141
+ end
3132
3142
end
3133
3143
end
3134
3144
You can’t perform that action at this time.
0 commit comments