File tree 2 files changed +41
-0
lines changed
2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 10
10
* [ #1976 ] ( https://github.com/ruby-grape/grape/pull/1976 ) : Ensure classes/modules listed for autoload really exist - [ @dnesteryuk ] ( https://github.com/dnesteryuk ) .
11
11
* [ #1971 ] ( https://github.com/ruby-grape/grape/pull/1971 ) : Fix BigDecimal coercion - [ @FlickStuart ] ( https://github.com/FlickStuart ) .
12
12
* [ #1968 ] ( https://github.com/ruby-grape/grape/pull/1968 ) : Fix args forwarding in Grape::Middleware::Stack#merge_with for ruby 2.7.0 - [ @dm1try ] ( https://github.com/dm1try ) .
13
+ * [ #1982 ] ( https://github.com/ruby-grape/grape/pull/1982 ) : Added failing spec for nested rescue_from declarations - [ @wowinter13 ] ( https://github.com/wowinter13 ) .
13
14
14
15
### 1.3.0 (2020/01/11)
15
16
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ # see https://github.com/ruby-grape/grape/issues/1975
4
+
5
+ require 'spec_helper'
6
+
7
+ module NestedRescueFromSpec
8
+ class Alpacas < Grape ::API
9
+ resource :alpacas do
10
+ rescue_from :all do
11
+ error_response ( status : 200 )
12
+ end
13
+
14
+ get do
15
+ { count_alpacas : 1 / 0 }
16
+ end
17
+ end
18
+ end
19
+
20
+ class Main < Grape ::API
21
+ rescue_from ZeroDivisionError do
22
+ error_response ( status : 500 )
23
+ end
24
+
25
+ mount NestedRescueFromSpec ::Alpacas
26
+ end
27
+ end
28
+
29
+ describe Grape ::API do
30
+ subject { NestedRescueFromSpec ::Main }
31
+
32
+ def app
33
+ subject
34
+ end
35
+
36
+ it 'calls the inner rescue_from :all from Alpacas class' do
37
+ get '/alpacas'
38
+ expect ( last_response . status ) . to eql 200
39
+ end
40
+ end
You can’t perform that action at this time.
0 commit comments