Skip to content

Commit 1076e6d

Browse files
committed
Simplify endpoint block execution and deprecate return call in it
1 parent 5dca095 commit 1076e6d

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

spec/grape/endpoint_spec.rb

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -785,29 +785,13 @@ def memoized
785785
return 'Hello'
786786
end
787787

788+
expect(Grape.deprecator).to receive(:warn).with('Using `return` in an endpoint has been deprecated.')
789+
788790
get '/home'
789791
expect(last_response.status).to eq(200)
790792
expect(last_response.body).to eq('Hello')
791793
end
792794

793-
describe '.generate_api_method' do
794-
it 'raises NameError if the method name is already in use' do
795-
expect do
796-
described_class.generate_api_method('version', &proc {})
797-
end.to raise_error(NameError)
798-
end
799-
800-
it 'raises ArgumentError if a block is not given' do
801-
expect do
802-
described_class.generate_api_method('GET without a block method')
803-
end.to raise_error(ArgumentError)
804-
end
805-
806-
it 'returns a Proc' do
807-
expect(described_class.generate_api_method('GET test for a proc', &proc {})).to be_a Proc
808-
end
809-
end
810-
811795
context 'filters' do
812796
describe 'before filters' do
813797
it 'runs the before filter if set' do

0 commit comments

Comments
 (0)