summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2016-12-28 11:36:28 +0000
committerRobert Schilling <rschilling@student.tugraz.at>2016-12-28 11:36:28 +0000
commit465700ddc2fa43bf32bc2ed08d9c30e420aec5e2 (patch)
tree66a39239e05ec326273ba42add41e72956b8e9fd
parent8aba0b0ed0ba93c59296f707f8c9a7d8ab1b498f (diff)
parent1b109c99a4802e2cc6598d19248013c0dc152d7a (diff)
downloadgitlab-ce-465700ddc2fa43bf32bc2ed08d9c30e420aec5e2.tar.gz
Merge branch 'fix-api-deprecation' into 'master'
Fix a Grape deprecation, use `#request_method` instead of `#route_method` See merge request !8297
-rw-r--r--changelogs/unreleased/fix-api-deprecation.yml4
-rw-r--r--lib/api/helpers.rb2
-rw-r--r--spec/requests/api/helpers_spec.rb4
3 files changed, 7 insertions, 3 deletions
diff --git a/changelogs/unreleased/fix-api-deprecation.yml b/changelogs/unreleased/fix-api-deprecation.yml
new file mode 100644
index 00000000000..90285ddf058
--- /dev/null
+++ b/changelogs/unreleased/fix-api-deprecation.yml
@@ -0,0 +1,4 @@
+---
+title: Fix a Grape deprecation, use `#request_method` instead of `#route_method`
+merge_request:
+author:
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index fe00c83bff3..ee9247ee240 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -96,7 +96,7 @@ module API
end
def authenticate_non_get!
- authenticate! unless %w[GET HEAD].include?(route.route_method)
+ authenticate! unless %w[GET HEAD].include?(route.request_method)
end
def authenticate_by_gitlab_shell_token!
diff --git a/spec/requests/api/helpers_spec.rb b/spec/requests/api/helpers_spec.rb
index c3d7ac3eef8..b8ee2293a33 100644
--- a/spec/requests/api/helpers_spec.rb
+++ b/spec/requests/api/helpers_spec.rb
@@ -396,7 +396,7 @@ describe API::Helpers, api: true do
%w[HEAD GET].each do |method_name|
context "method is #{method_name}" 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
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|
context "method is #{method_name}" 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
it 'calls authenticate!' do