diff options
| author | mo khan <mo.khan@gmail.com> | 2020-04-21 23:15:36 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-04-21 23:15:36 -0600 |
| commit | e1afa8ba55a3df1151e1b73ed3aa528e53ea3f06 (patch) | |
| tree | 5ca6d1073f8aa9dbf7515c9f3dff9378fcdd3ee9 /spec/unit | |
| parent | 2edd529220ecda2b14b99c1e9c15497b1f2ae639 (diff) | |
Remove old report versions
Diffstat (limited to 'spec/unit')
| -rw-r--r-- | spec/unit/gitlab_spec.rb | 5 | ||||
| -rw-r--r-- | spec/unit/license/management/report/v2_spec.rb | 54 | ||||
| -rw-r--r-- | spec/unit/license/management/repository_spec.rb | 47 |
3 files changed, 0 insertions, 106 deletions
diff --git a/spec/unit/gitlab_spec.rb b/spec/unit/gitlab_spec.rb deleted file mode 100644 index 997c067..0000000 --- a/spec/unit/gitlab_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Spandx::Gitlab do - specify { expect(Spandx::Gitlab::VERSION).not_to be_nil } -end diff --git a/spec/unit/license/management/report/v2_spec.rb b/spec/unit/license/management/report/v2_spec.rb deleted file mode 100644 index 8ba2fa3..0000000 --- a/spec/unit/license/management/report/v2_spec.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe License::Management::Report::V2 do - describe '#to_h' do - { - 'AGPL-1.0' => 'AGPL-1.0', - 'AGPL-3.0' => 'AGPL-3.0', - 'Apache 2.0' => 'Apache-2.0', - 'Artistic-2.0' => 'Artistic-2.0', - 'BSD' => 'BSD-4-Clause', - 'CC0 1.0 Universal' => 'CC0-1.0', - 'CDDL-1.0' => 'CDDL-1.0', - 'CDDL-1.1' => 'CDDL-1.1', - 'EPL-1.0' => 'EPL-1.0', - 'EPL-2.0' => 'EPL-2.0', - 'GPLv2' => 'GPL-2.0', - 'GPLv3' => 'GPL-3.0', - 'ISC' => 'ISC', - 'LGPL' => 'LGPL-3.0-only', - 'LGPL-2.1' => 'LGPL-2.1', - 'MIT' => 'MIT', - 'Mozilla Public License 2.0' => 'MPL-2.0', - 'MS-PL' => 'MS-PL', - 'MS-RL' => 'MS-RL', - 'New BSD' => 'BSD-3-Clause', - 'Python Software Foundation License' => 'Python-2.0', - 'ruby' => 'Ruby', - 'Simplified BSD' => 'BSD-2-Clause', - 'WTFPL' => 'WTFPL', - 'Zlib' => 'Zlib' - }.each do |old_name, spdx_id| - context "when mapping the legacy license name #{old_name}" do - subject { described_class.new([dependency]) } - - let(:license) { LicenseFinder::License.new(short_name: old_name, matcher: LicenseFinder::License::NoneMatcher.new, url: nil) } - let(:dependency) { instance_double(LicenseFinder::Package, name: 'x', summary: '', description: '', homepage: '', licenses: [license]).as_null_object } - let(:result) { subject.to_h } - - specify { expect(result[:version]).to eq('2.0') } - specify { expect(result[:licenses].count).to be(1) } - specify { expect(result[:licenses][0]['id']).to eq(spdx_id) } - end - end - - context 'when choosing an appropriate url for a license' do - subject { described_class.new([dependency]) } - - let(:license) { LicenseFinder::License.new(short_name: 'MIT', matcher: LicenseFinder::License::NoneMatcher.new, url: nil) } - let(:dependency) { instance_double(LicenseFinder::Package, name: 'x', summary: '', description: '', homepage: '', licenses: [license]).as_null_object } - - specify { expect(subject.to_h[:licenses][0]['url']).to eql('https://opensource.org/licenses/MIT') } - end - end -end diff --git a/spec/unit/license/management/repository_spec.rb b/spec/unit/license/management/repository_spec.rb deleted file mode 100644 index 5ab7a03..0000000 --- a/spec/unit/license/management/repository_spec.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe License::Management::Repository do - describe '#item_for' do - let(:spdx_licenses) { JSON.parse(IO.read('spdx-licenses.json'))['licenses'] } - - context 'when mapping a license that refers to opensource.org' do - it 'parses the SPDX id from the url' do - spdx_licenses.each do |license| - spdx_id = license['licenseId'] - url = "https://opensource.org/licenses/#{spdx_id}" - license = LicenseFinder::License.new(short_name: url, matcher: LicenseFinder::License::NoneMatcher.new, url: url) - expect(subject.item_for(license)['id']).to eql(spdx_id) - end - end - - it 'recognizes `http://www.opensource.org/licenses/mit-license.php`' do - url = 'http://www.opensource.org/licenses/mit-license.php' - license = LicenseFinder::License.new(short_name: url, matcher: LicenseFinder::License::NoneMatcher.new, url: url) - - expect(subject.item_for(license)['id']).to eql('MIT') - end - end - - context 'when mapping a license that refers to nuget.org' do - it 'parses the SPDX id from the url' do - spdx_licenses.each do |license| - spdx_id = license['licenseId'] - url = "https://licenses.nuget.org/#{spdx_id}" - license = LicenseFinder::License.new(short_name: url, matcher: LicenseFinder::License::NoneMatcher.new, url: url) - expect(subject.item_for(license)['id']).to eql(spdx_id) - end - end - end - - [ - ['Apache License v2.0', 'Apache-2.0'] - ].each do |short_name, spdx_id| - context "when mapping a `#{short_name}` license" do - let(:license) { LicenseFinder::License.new(short_name: short_name, matcher: LicenseFinder::License::NoneMatcher.new, url: nil) } - let(:dependency) { double(name: 'x', summary: '', description: '', homepage: '', licenses: [license]) } - - it { expect(subject.item_for(license)['id']).to eql(spdx_id) } - end - end - end -end |
