Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-08-09 20:29:45 +0300
committerRémy Coutable <remy@rymai.me>2016-08-09 20:29:45 +0300
commit11a60096f6f60a383dc73ffd87384f078f27b0f6 (patch)
tree5903df84b19ca86f24f2f4e6a6730f1f44f5fdde
parentb8130d42c212a45ad1e568f191337f0bed0a3d01 (diff)
parentda29a55d81d0cc24af513a00d08bee4d920061de (diff)
Merge branch 'upgrade-grape' into 'master'
Update Grape from 0.13.0 to 0.15.0 Changelog: https://github.com/ruby-grape/grape/blob/v0.15.0/CHANGELOG.md Working on #18226. See merge request !4601
-rw-r--r--CHANGELOG1
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock4
-rw-r--r--lib/api/api.rb6
-rw-r--r--spec/requests/api/users_spec.rb15
5 files changed, 13 insertions, 15 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 7bfeff2a4ec..f83a86d75df 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -33,6 +33,7 @@ v 8.11.0 (unreleased)
- Remove delay when hitting "Reply..." button on page with a lot of discussions
- Retrieve rendered HTML from cache in one request
- Fix renaming repository when name contains invalid chararacters under project settings
+ - Upgrade Grape from 0.13.0 to 0.15.0. !4601
- Fix devise deprecation warnings.
- Update version_sorter and use new interface for faster tag sorting
- Optimize checking if a user has read access to a list of issues !5370
diff --git a/Gemfile b/Gemfile
index 104929665e8..91f4f20215f 100644
--- a/Gemfile
+++ b/Gemfile
@@ -69,7 +69,7 @@ gem 'gollum-rugged_adapter', '~> 0.4.2', require: false
gem 'github-linguist', '~> 4.7.0', require: 'linguist'
# API
-gem 'grape', '~> 0.13.0'
+gem 'grape', '~> 0.15.0'
gem 'grape-entity', '~> 0.4.2'
gem 'rack-cors', '~> 0.4.0', require: 'rack/cors'
diff --git a/Gemfile.lock b/Gemfile.lock
index 87f08d6f372..43ed6081274 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -308,7 +308,7 @@ GEM
json
multi_json
request_store (>= 1.0)
- grape (0.13.0)
+ grape (0.15.0)
activesupport
builder
hashie (>= 2.1.0)
@@ -876,7 +876,7 @@ DEPENDENCIES
gollum-lib (~> 4.2)
gollum-rugged_adapter (~> 0.4.2)
gon (~> 6.1.0)
- grape (~> 0.13.0)
+ grape (~> 0.15.0)
grape-entity (~> 0.4.2)
hamlit (~> 2.5)
health_check (~> 2.1.0)
diff --git a/lib/api/api.rb b/lib/api/api.rb
index bd16806892b..6cd4a853dbe 100644
--- a/lib/api/api.rb
+++ b/lib/api/api.rb
@@ -7,8 +7,10 @@ module API
rack_response({ 'message' => '404 Not found' }.to_json, 404)
end
- rescue_from Grape::Exceptions::ValidationErrors do |e|
- error!({ messages: e.full_messages }, 400)
+ # Retain 405 error rather than a 500 error for Grape 0.15.0+.
+ # See: https://github.com/ruby-grape/grape/commit/252bfd27c320466ec3c0751812cf44245e97e5de
+ rescue_from Grape::Exceptions::Base do |e|
+ error! e.message, e.status, e.headers
end
rescue_from :all do |exception|
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index 69b5072a81e..e0e041b4e15 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -398,9 +398,9 @@ describe API::API, api: true do
end.to change{ user.keys.count }.by(1)
end
- it "returns 405 for invalid ID" do
- post api("/users/ASDF/keys", admin)
- expect(response).to have_http_status(405)
+ it "returns 400 for invalid ID" do
+ post api("/users/999999/keys", admin)
+ expect(response).to have_http_status(400)
end
end
@@ -429,11 +429,6 @@ describe API::API, api: true do
expect(json_response).to be_an Array
expect(json_response.first['title']).to eq(key.title)
end
-
- it "returns 405 for invalid ID" do
- get api("/users/ASDF/keys", admin)
- expect(response).to have_http_status(405)
- end
end
end
@@ -490,8 +485,8 @@ describe API::API, api: true do
end
it "raises error for invalid ID" do
- post api("/users/ASDF/emails", admin)
- expect(response).to have_http_status(405)
+ post api("/users/999999/emails", admin)
+ expect(response).to have_http_status(400)
end
end