File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 7
7
#### Fixes
8
8
9
9
* Your contribution here.
10
+ * [ #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 ) .
10
11
11
12
### 1.3.0 (2020/01/11)
12
13
Original file line number Diff line number Diff line change @@ -78,7 +78,8 @@ def use(*args, &block)
78
78
def merge_with ( middleware_specs )
79
79
middleware_specs . each do |operation , *args |
80
80
if args . last . is_a? ( Proc )
81
- public_send ( operation , *args , &args . pop )
81
+ last_proc = args . pop
82
+ public_send ( operation , *args , &last_proc )
82
83
else
83
84
public_send ( operation , *args )
84
85
end
Original file line number Diff line number Diff line change @@ -111,6 +111,15 @@ def initialize(&block)
111
111
expect ( subject [ 1 ] ) . to eq ( StackSpec ::BlockMiddleware )
112
112
expect ( subject [ 2 ] ) . to eq ( StackSpec ::BarMiddleware )
113
113
end
114
+
115
+ context 'middleware spec with proc declaration exists' do
116
+ let ( :middleware_spec_with_proc ) { [ :use , StackSpec ::FooMiddleware , proc ] }
117
+
118
+ it 'properly forwards spec arguments' do
119
+ expect ( subject ) . to receive ( :use ) . with ( StackSpec ::FooMiddleware )
120
+ subject . merge_with ( [ middleware_spec_with_proc ] )
121
+ end
122
+ end
114
123
end
115
124
116
125
describe '#build' do
You can’t perform that action at this time.
0 commit comments