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 77#### Fixes
88
99* 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 ) .
1011
1112### 1.3.0 (2020/01/11)
1213
Original file line number Diff line number Diff line change @@ -78,7 +78,8 @@ def use(*args, &block)
7878 def merge_with ( middleware_specs )
7979 middleware_specs . each do |operation , *args |
8080 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 )
8283 else
8384 public_send ( operation , *args )
8485 end
Original file line number Diff line number Diff line change @@ -111,6 +111,15 @@ def initialize(&block)
111111 expect ( subject [ 1 ] ) . to eq ( StackSpec ::BlockMiddleware )
112112 expect ( subject [ 2 ] ) . to eq ( StackSpec ::BarMiddleware )
113113 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
114123 end
115124
116125 describe '#build' do
You can’t perform that action at this time.
0 commit comments