@@ -262,30 +262,40 @@ class BogusEntity < Grape::Entity
262262 end
263263 end
264264
265- context 'with block passed via &' do
266- it 'with does not pass options when block is passed via &' do
267- class SomeObject
268- def method_without_args
269- 'result'
270- end
265+ describe 'blocks' do
266+ class SomeObject
267+ def method_without_args
268+ 'result'
271269 end
270+ end
272271
273- subject . expose :that_method_without_args do |object |
274- object . method_without_args
275- end
272+ describe 'with block passed in' do
273+ specify do
274+ subject . expose :that_method_without_args do |object |
275+ object . method_without_args
276+ end
276277
277- subject . expose :that_method_without_args_again , & :method_without_args
278+ object = SomeObject . new
278279
279- object = SomeObject . new
280+ value = subject . represent ( object ) . value_for ( :that_method_without_args )
281+ expect ( value ) . to eq ( 'result' )
282+ end
283+ end
280284
281- value = subject . represent ( object ) . value_for ( :that_method_without_args )
282- expect ( value ) . to eq ( 'result' )
285+ context 'with block passed in via &' do
286+ specify do
287+ subject . expose :that_method_without_args_again , &:method_without_args
283288
284- if RUBY_VERSION . start_with? ( '3' )
285- expect { subject . represent ( object ) . value_for ( :that_method_without_args_again ) } . to raise_error Grape ::Entity ::Deprecated
286- else
287- value2 = subject . represent ( object ) . value_for ( :that_method_without_args_again )
288- expect ( value2 ) . to eq ( 'result' )
289+ object = SomeObject . new
290+
291+ if RUBY_VERSION . start_with? ( '3' )
292+ expect do
293+ subject . represent ( object ) . value_for ( :that_method_without_args_again )
294+ end . to raise_error Grape ::Entity ::Deprecated
295+ else
296+ value2 = subject . represent ( object ) . value_for ( :that_method_without_args_again )
297+ expect ( value2 ) . to eq ( 'result' )
298+ end
289299 end
290300 end
291301 end
0 commit comments