Commit 2f18c77e authored by Rémy Coutable's avatar Rémy Coutable

Update to licensee 8.0.0 and fix API specs

Signed-off-by: 's avatarRémy Coutable <remy@rymai.me>
parent 0aaaae9d
......@@ -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'
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment