Fix a Grape deprecation, use #request_method
instead of #route_method
Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
parent
5866f7b30e
commit
1b109c99a4
3 changed files with 7 additions and 3 deletions
4
changelogs/unreleased/fix-api-deprecation.yml
Normal file
4
changelogs/unreleased/fix-api-deprecation.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
title: Fix a Grape deprecation, use `#request_method` instead of `#route_method`
|
||||||
|
merge_request:
|
||||||
|
author:
|
|
@ -96,7 +96,7 @@ module API
|
||||||
end
|
end
|
||||||
|
|
||||||
def authenticate_non_get!
|
def authenticate_non_get!
|
||||||
authenticate! unless %w[GET HEAD].include?(route.route_method)
|
authenticate! unless %w[GET HEAD].include?(route.request_method)
|
||||||
end
|
end
|
||||||
|
|
||||||
def authenticate_by_gitlab_shell_token!
|
def authenticate_by_gitlab_shell_token!
|
||||||
|
|
|
@ -396,7 +396,7 @@ describe API::Helpers, api: true do
|
||||||
%w[HEAD GET].each do |method_name|
|
%w[HEAD GET].each do |method_name|
|
||||||
context "method is #{method_name}" do
|
context "method is #{method_name}" do
|
||||||
before do
|
before do
|
||||||
expect_any_instance_of(self.class).to receive(:route).and_return(double(route_method: method_name))
|
expect_any_instance_of(self.class).to receive(:route).and_return(double(request_method: method_name))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not raise an error' do
|
it 'does not raise an error' do
|
||||||
|
@ -410,7 +410,7 @@ describe API::Helpers, api: true do
|
||||||
%w[POST PUT PATCH DELETE].each do |method_name|
|
%w[POST PUT PATCH DELETE].each do |method_name|
|
||||||
context "method is #{method_name}" do
|
context "method is #{method_name}" do
|
||||||
before do
|
before do
|
||||||
expect_any_instance_of(self.class).to receive(:route).and_return(double(route_method: method_name))
|
expect_any_instance_of(self.class).to receive(:route).and_return(double(request_method: method_name))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'calls authenticate!' do
|
it 'calls authenticate!' do
|
||||||
|
|
Loading…
Reference in a new issue