diff options
author | Rémy Coutable <remy@rymai.me> | 2016-04-13 15:56:37 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-04-18 14:47:50 +0200 |
commit | 2f18c77e1b0e3b6f3d668c3cb1814d4675641a75 (patch) | |
tree | 375a7e268cd000dabbdae555f137c280b80e7bf0 | |
parent | 0aaaae9d0536c5637662f6c72a6612ec13f0342f (diff) | |
download | gitlab-ce-2f18c77e1b0e3b6f3d668c3cb1814d4675641a75.tar.gz |
Update to licensee 8.0.0 and fix API specs
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 6 | ||||
-rw-r--r-- | lib/api/entities.rb | 9 | ||||
-rw-r--r-- | spec/requests/api/licenses_spec.rb | 8 |
4 files changed, 13 insertions, 12 deletions
@@ -191,7 +191,7 @@ gem 'babosa', '~> 1.0.2' gem "loofah", "~> 2.0.3" # Working with license -gem 'licensee', "~> 7.0.0" +gem 'licensee', '~> 8.0.0' # Protect against bruteforcing gem "rack-attack", '~> 4.3.1' diff --git a/Gemfile.lock b/Gemfile.lock index 2a6faeff2f4..3cff184b00b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -452,8 +452,8 @@ GEM addressable (~> 2.3) letter_opener (1.1.2) launchy (~> 2.2) - licensee (7.0.0) - rugged (~> 0.23) + licensee (8.0.0) + rugged (>= 0.24b) listen (3.0.5) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) @@ -959,7 +959,7 @@ DEPENDENCIES jquery-ui-rails (~> 5.0.0) kaminari (~> 0.16.3) letter_opener (~> 1.1.2) - licensee (~> 7.0.0) + licensee (~> 8.0.0) loofah (~> 2.0.3) mail_room (~> 0.6.1) method_source (~> 0.8) diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 61df948df60..e7af928b0e9 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -441,13 +441,14 @@ module API end class License < Grape::Entity - expose :key, :name, :nickname, :featured + expose :key, :name, :nickname + expose :featured, as: :popular expose :url, as: :html_url expose(:source_url) { |license| license.meta['source'] } expose(:description) { |license| license.meta['description'] } - expose(:conditions) { |license| license.meta['required'] } - expose(:permissions) { |license| license.meta['permitted'] } - expose(:limitations) { |license| license.meta['forbidden'] } + expose(:conditions) { |license| license.meta['conditions'] } + expose(:permissions) { |license| license.meta['permissions'] } + expose(:limitations) { |license| license.meta['limitations'] } expose :content end end diff --git a/spec/requests/api/licenses_spec.rb b/spec/requests/api/licenses_spec.rb index 61a58231c54..c17dcb222a9 100644 --- a/spec/requests/api/licenses_spec.rb +++ b/spec/requests/api/licenses_spec.rb @@ -9,9 +9,9 @@ describe API::Licenses, api: true do it { expect(json_response['key']).to eq('mit') } it { expect(json_response['name']).to eq('MIT License') } it { expect(json_response['nickname']).to be_nil } - it { expect(json_response['featured']).to be true } + it { expect(json_response['popular']).to be true } it { expect(json_response['html_url']).to eq('http://choosealicense.com/licenses/mit/') } - it { expect(json_response['source_url']).to eq('http://opensource.org/licenses/MIT') } + it { expect(json_response['source_url']).to eq('https://opensource.org/licenses/MIT') } it { expect(json_response['description']).to include('A permissive license that is short and to the point.') } it { expect(json_response['conditions']).to eq(%w[include-copyright]) } it { expect(json_response['permissions']).to eq(%w[commercial-use modifications distribution private-use]) } @@ -26,7 +26,7 @@ describe API::Licenses, api: true do expect(response.status).to eq(200) expect(json_response).to be_an Array expect(json_response.size).to eq(15) - expect(json_response.first['key']).to eq('agpl-3.0') + expect(json_response.map { |l| l['key'] }).to include('agpl-3.0') end describe 'the popular parameter' do @@ -37,7 +37,7 @@ describe API::Licenses, api: true do expect(response.status).to eq(200) expect(json_response).to be_an Array expect(json_response.size).to eq(3) - expect(json_response.first['key']).to eq('apache-2.0') + expect(json_response.map { |l| l['key'] }).to include('apache-2.0') end end end |