licensee 9.12.0 → 9.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/licensee +3 -3
- data/lib/licensee/commands/detect.rb +5 -5
- data/lib/licensee/content_helper.rb +53 -8
- data/lib/licensee/hash_helper.rb +5 -5
- data/lib/licensee/license.rb +16 -20
- data/lib/licensee/matchers/dice.rb +3 -3
- data/lib/licensee/projects/git_project.rb +3 -3
- data/lib/licensee/projects/project.rb +3 -3
- data/lib/licensee/version.rb +1 -1
- data/licensee.gemspec +47 -0
- data/spec/bin_spec.rb +1 -1
- data/spec/fixture_spec.rb +5 -5
- data/spec/fixtures/cc0-cal2013/LICENSE +116 -0
- data/spec/fixtures/cc0-cc/LICENSE +121 -0
- data/spec/fixtures/detect.json +1 -1
- data/spec/fixtures/fixtures.yml +12 -0
- data/spec/fixtures/license-hashes.json +5 -4
- data/spec/fixtures/unlicense-noinfo/LICENSE +22 -0
- data/spec/integration_spec.rb +30 -2
- data/spec/licensee/commands/detect_spec.rb +4 -4
- data/spec/licensee/commands/license_path_spec.rb +1 -1
- data/spec/licensee/commands/version_spec.rb +1 -1
- data/spec/licensee/content_helper_spec.rb +43 -42
- data/spec/licensee/hash_helper_spec.rb +1 -1
- data/spec/licensee/license_field_spec.rb +3 -3
- data/spec/licensee/license_meta_spec.rb +13 -11
- data/spec/licensee/license_rules_spec.rb +4 -2
- data/spec/licensee/license_spec.rb +33 -33
- data/spec/licensee/matchers/cabal_matcher_spec.rb +4 -2
- data/spec/licensee/matchers/cargo_matcher_spec.rb +3 -2
- data/spec/licensee/matchers/copyright_matcher_spec.rb +3 -3
- data/spec/licensee/matchers/cran_matcher_spec.rb +3 -2
- data/spec/licensee/matchers/dice_matcher_spec.rb +11 -10
- data/spec/licensee/matchers/dist_zilla_matcher_spec.rb +3 -2
- data/spec/licensee/matchers/exact_matcher_spec.rb +3 -2
- data/spec/licensee/matchers/gemspec_matcher_spec.rb +3 -2
- data/spec/licensee/matchers/matcher_spec.rb +4 -2
- data/spec/licensee/matchers/npm_bower_matcher_spec.rb +3 -3
- data/spec/licensee/matchers/package_matcher_spec.rb +4 -2
- data/spec/licensee/matchers/reference_matcher_spec.rb +2 -2
- data/spec/licensee/matchers/spdx_matcher_spec.rb +3 -2
- data/spec/licensee/project_files/license_file_spec.rb +15 -15
- data/spec/licensee/project_files/package_info_spec.rb +3 -1
- data/spec/licensee/project_files/project_file_spec.rb +5 -2
- data/spec/licensee/project_files/readme_file_spec.rb +2 -1
- data/spec/licensee/project_spec.rb +22 -17
- data/spec/licensee/projects/github_project_spec.rb +6 -5
- data/spec/licensee/rule_spec.rb +4 -3
- data/spec/licensee_spec.rb +10 -9
- data/spec/spec_helper.rb +2 -2
- data/spec/vendored_license_spec.rb +3 -3
- data/vendor/choosealicense.com/_data/rules.yml +3 -0
- data/vendor/choosealicense.com/_licenses/bsd-3-clause-clear.txt +1 -0
- data/vendor/choosealicense.com/_licenses/bsd-4-clause.txt +61 -0
- data/vendor/choosealicense.com/_licenses/bsl-1.0.txt +4 -1
- data/vendor/choosealicense.com/_licenses/cc-by-4.0.txt +3 -0
- data/vendor/choosealicense.com/_licenses/cc-by-sa-4.0.txt +3 -0
- data/vendor/choosealicense.com/_licenses/cc0-1.0.txt +112 -103
- data/vendor/choosealicense.com/_licenses/ofl-1.1.txt +3 -0
- data/vendor/choosealicense.com/_licenses/zlib.txt +4 -1
- metadata +37 -4
@@ -6,7 +6,7 @@ RSpec.describe Licensee::LicenseField do
|
|
6
6
|
context 'class' do
|
7
7
|
it 'returns all license fields' do
|
8
8
|
expect(described_class.all.count).to eql(expected_count)
|
9
|
-
expect(described_class.all.first).to be_a(
|
9
|
+
expect(described_class.all.first).to be_a(described_class)
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'returns all license field keys' do
|
@@ -35,7 +35,7 @@ RSpec.describe Licensee::LicenseField do
|
|
35
35
|
let(:fields) { described_class.from_array(array) }
|
36
36
|
|
37
37
|
it 'returns an array of LicenseFields' do
|
38
|
-
expect(fields.count).to
|
38
|
+
expect(fields.count).to be(2)
|
39
39
|
expect(fields.first).to be_a(described_class)
|
40
40
|
expect(fields.first.name).to eql('year')
|
41
41
|
expect(fields.last.name).to eql('fullname')
|
@@ -47,7 +47,7 @@ RSpec.describe Licensee::LicenseField do
|
|
47
47
|
let(:fields) { described_class.from_content(content) }
|
48
48
|
|
49
49
|
it 'pulls fields from content' do
|
50
|
-
expect(fields.count).to
|
50
|
+
expect(fields.count).to be(2)
|
51
51
|
expect(fields.first.key).to eql('year')
|
52
52
|
expect(fields[1].key).to eql('fullname')
|
53
53
|
end
|
@@ -16,7 +16,7 @@ RSpec.describe Licensee::LicenseMeta do
|
|
16
16
|
|
17
17
|
it 'responds to the field as a hash key' do
|
18
18
|
if field['required']
|
19
|
-
expect(subject[name]).
|
19
|
+
expect(subject[name]).not_to be_nil
|
20
20
|
else
|
21
21
|
expect { subject[name] }.not_to raise_error
|
22
22
|
end
|
@@ -38,11 +38,12 @@ RSpec.describe Licensee::LicenseMeta do
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
|
41
|
+
describe '#from_hash' do
|
42
|
+
subject { described_class.from_hash(hash) }
|
43
|
+
|
42
44
|
let(:hash) do
|
43
45
|
{ 'title' => 'Test license', 'description' => 'A test license' }
|
44
46
|
end
|
45
|
-
subject { described_class.from_hash(hash) }
|
46
47
|
|
47
48
|
it 'sets values' do
|
48
49
|
expect(subject.title).to eql('Test license')
|
@@ -72,25 +73,26 @@ RSpec.describe Licensee::LicenseMeta do
|
|
72
73
|
end
|
73
74
|
end
|
74
75
|
|
75
|
-
|
76
|
-
let(:yaml) { "title: Test license\ndescription: A test license" }
|
76
|
+
describe '#from_yaml' do
|
77
77
|
subject { described_class.from_yaml(yaml) }
|
78
78
|
|
79
|
+
let(:yaml) { "title: Test license\ndescription: A test license" }
|
80
|
+
|
79
81
|
it 'parses yaml' do
|
80
82
|
expect(subject.title).to eql('Test license')
|
81
83
|
expect(subject.description).to eql('A test license')
|
82
84
|
end
|
83
85
|
|
84
86
|
it 'sets defaults' do
|
85
|
-
expect(subject.hidden).to
|
86
|
-
expect(subject.featured).to
|
87
|
+
expect(subject.hidden).to be(true)
|
88
|
+
expect(subject.featured).to be(false)
|
87
89
|
end
|
88
90
|
|
89
91
|
context 'nil yaml' do
|
90
92
|
let(:yaml) { nil }
|
91
93
|
|
92
94
|
it 'returns defaults' do
|
93
|
-
expect(subject.hidden).to
|
95
|
+
expect(subject.hidden).to be(true)
|
94
96
|
end
|
95
97
|
end
|
96
98
|
|
@@ -98,15 +100,15 @@ RSpec.describe Licensee::LicenseMeta do
|
|
98
100
|
let(:yaml) { '' }
|
99
101
|
|
100
102
|
it 'returns defaults' do
|
101
|
-
expect(subject.featured).to
|
103
|
+
expect(subject.featured).to be(false)
|
102
104
|
end
|
103
105
|
end
|
104
106
|
end
|
105
107
|
|
106
108
|
it 'returns the list of helper methods' do
|
107
|
-
expect(described_class.helper_methods.length).to
|
109
|
+
expect(described_class.helper_methods.length).to be(13)
|
108
110
|
expect(described_class.helper_methods).to include(:hidden?)
|
109
|
-
expect(described_class.helper_methods).
|
111
|
+
expect(described_class.helper_methods).not_to include(:hidden)
|
110
112
|
expect(described_class.helper_methods).to include(:title)
|
111
113
|
end
|
112
114
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
RSpec.describe Licensee::LicenseRules do
|
4
|
-
let(:mit) { Licensee::License.find('mit') }
|
5
4
|
subject { mit.rules }
|
6
5
|
|
6
|
+
let(:mit) { Licensee::License.find('mit') }
|
7
|
+
|
7
8
|
Licensee::Rule.groups.each do |group|
|
8
9
|
context "the #{group} rule group" do
|
9
10
|
it 'responds as a hash key string' do
|
@@ -37,9 +38,10 @@ RSpec.describe Licensee::LicenseRules do
|
|
37
38
|
end
|
38
39
|
|
39
40
|
context 'created from a hash' do
|
40
|
-
let(:hash) { { 'permissions' => Licensee::Rule.all } }
|
41
41
|
subject { described_class.from_hash(hash) }
|
42
42
|
|
43
|
+
let(:hash) { { 'permissions' => Licensee::Rule.all } }
|
44
|
+
|
43
45
|
it 'exposes the rules' do
|
44
46
|
expect(subject.permissions.first.label).to eql('Commercial use')
|
45
47
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
RSpec.describe Licensee::License do
|
4
|
-
let(:license_count) {
|
4
|
+
let(:license_count) { 40 }
|
5
5
|
let(:hidden_license_count) { 27 }
|
6
6
|
let(:featured_license_count) { 3 }
|
7
7
|
let(:pseudo_license_count) { 2 }
|
@@ -35,7 +35,7 @@ RSpec.describe Licensee::License do
|
|
35
35
|
let(:arguments) { {} }
|
36
36
|
|
37
37
|
it 'returns the licenses' do
|
38
|
-
expect(licenses).to all be_a(
|
38
|
+
expect(licenses).to all be_a(described_class)
|
39
39
|
expect(licenses.count).to eql(license_count - hidden_license_count)
|
40
40
|
end
|
41
41
|
|
@@ -45,8 +45,8 @@ RSpec.describe Licensee::License do
|
|
45
45
|
|
46
46
|
it 'includes featured licenses' do
|
47
47
|
expect(licenses).to include(mit)
|
48
|
-
expect(licenses).
|
49
|
-
expect(licenses).
|
48
|
+
expect(licenses).not_to include(cc_by)
|
49
|
+
expect(licenses).not_to include(other)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -65,8 +65,8 @@ RSpec.describe Licensee::License do
|
|
65
65
|
|
66
66
|
it 'includes only featured licenses' do
|
67
67
|
expect(licenses).to include(mit)
|
68
|
-
expect(licenses).
|
69
|
-
expect(licenses).
|
68
|
+
expect(licenses).not_to include(cc_by)
|
69
|
+
expect(licenses).not_to include(other)
|
70
70
|
expect(licenses.count).to eql(featured_license_count)
|
71
71
|
end
|
72
72
|
end
|
@@ -76,8 +76,8 @@ RSpec.describe Licensee::License do
|
|
76
76
|
|
77
77
|
it 'includes only non-featured licenses' do
|
78
78
|
expect(licenses).to include(unlicense)
|
79
|
-
expect(licenses).
|
80
|
-
expect(licenses).
|
79
|
+
expect(licenses).not_to include(mit)
|
80
|
+
expect(licenses).not_to include(other)
|
81
81
|
expect(licenses.count).to eql(non_featured_license_count)
|
82
82
|
end
|
83
83
|
|
@@ -87,20 +87,20 @@ RSpec.describe Licensee::License do
|
|
87
87
|
it 'includes only non-featured licenses' do
|
88
88
|
expect(licenses).to include(unlicense)
|
89
89
|
expect(licenses).to include(cc_by)
|
90
|
-
expect(licenses).
|
90
|
+
expect(licenses).not_to include(mit)
|
91
91
|
expect(licenses.count).to eql(license_count - featured_license_count)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
96
|
context 'pseudo licenses' do
|
97
|
-
let(:other) {
|
97
|
+
let(:other) { described_class.find('other') }
|
98
98
|
|
99
99
|
context 'by default' do
|
100
100
|
let(:arguments) { {} }
|
101
101
|
|
102
102
|
it "doesn't include pseudo licenses" do
|
103
|
-
expect(licenses).
|
103
|
+
expect(licenses).not_to include(other)
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -124,7 +124,7 @@ RSpec.describe Licensee::License do
|
|
124
124
|
let(:arguments) { { hidden: true, pseudo: false } }
|
125
125
|
|
126
126
|
it "doesn'tincludes psudo licenses" do
|
127
|
-
expect(licenses).
|
127
|
+
expect(licenses).not_to include(other)
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
@@ -141,7 +141,7 @@ RSpec.describe Licensee::License do
|
|
141
141
|
let(:arguments) { { hidden: true, psuedo: false } }
|
142
142
|
|
143
143
|
it "doesn'tincludes psudo licenses" do
|
144
|
-
expect(licenses).
|
144
|
+
expect(licenses).not_to include(other)
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
@@ -197,9 +197,9 @@ RSpec.describe Licensee::License do
|
|
197
197
|
expect(no_license.spdx_id).to eql('NONE')
|
198
198
|
end
|
199
199
|
|
200
|
-
|
200
|
+
describe '#other?' do
|
201
201
|
it 'knows MIT is not other' do
|
202
|
-
expect(gpl).
|
202
|
+
expect(gpl).not_to be_other
|
203
203
|
end
|
204
204
|
|
205
205
|
it 'knows the other license is other?' do
|
@@ -216,7 +216,7 @@ RSpec.describe Licensee::License do
|
|
216
216
|
end
|
217
217
|
|
218
218
|
it 'includes defaults' do
|
219
|
-
expect(other.meta['hidden']).to
|
219
|
+
expect(other.meta['hidden']).to be(true)
|
220
220
|
end
|
221
221
|
|
222
222
|
it 'returns the name' do
|
@@ -238,27 +238,27 @@ RSpec.describe Licensee::License do
|
|
238
238
|
end
|
239
239
|
|
240
240
|
it 'knows if a license is hidden' do
|
241
|
-
expect(mit).
|
241
|
+
expect(mit).not_to be_hidden
|
242
242
|
expect(cc_by).to be_hidden
|
243
243
|
end
|
244
244
|
|
245
245
|
it 'knows if a license is featured' do
|
246
246
|
expect(mit).to be_featured
|
247
|
-
expect(unlicense).
|
247
|
+
expect(unlicense).not_to be_featured
|
248
248
|
end
|
249
249
|
|
250
250
|
it 'knows if a license is GPL' do
|
251
|
-
expect(mit).
|
251
|
+
expect(mit).not_to be_gpl
|
252
252
|
expect(gpl).to be_gpl
|
253
253
|
end
|
254
254
|
|
255
255
|
it 'knows a license is lgpl' do
|
256
|
-
expect(mit).
|
256
|
+
expect(mit).not_to be_gpl
|
257
257
|
expect(lgpl).to be_lgpl
|
258
258
|
end
|
259
259
|
|
260
260
|
it 'knows if a license is CC' do
|
261
|
-
expect(gpl).
|
261
|
+
expect(gpl).not_to be_creative_commons
|
262
262
|
expect(cc_by).to be_creative_commons
|
263
263
|
end
|
264
264
|
end
|
@@ -301,11 +301,11 @@ RSpec.describe Licensee::License do
|
|
301
301
|
|
302
302
|
it 'knows equality' do
|
303
303
|
expect(mit).to eql(mit)
|
304
|
-
expect(gpl).
|
304
|
+
expect(gpl).not_to eql(mit)
|
305
305
|
end
|
306
306
|
|
307
307
|
it 'knows if a license is a pseudo license' do
|
308
|
-
expect(mit).
|
308
|
+
expect(mit).not_to be_pseudo_license
|
309
309
|
expect(other).to be_pseudo_license
|
310
310
|
end
|
311
311
|
|
@@ -319,24 +319,24 @@ RSpec.describe Licensee::License do
|
|
319
319
|
expect(mit.rules).to be_a(Licensee::LicenseRules)
|
320
320
|
expect(mit.rules).to have_key('permissions')
|
321
321
|
expect(mit.rules['permissions'].first).to be_a(Licensee::Rule)
|
322
|
-
expect(mit.rules.flatten.count).to
|
322
|
+
expect(mit.rules.flatten.count).to be(7)
|
323
323
|
end
|
324
324
|
|
325
325
|
it 'returns rules by tag and group' do
|
326
326
|
expect(cc_by.rules).to have_key('limitations')
|
327
327
|
rule = cc_by.rules['limitations'].find { |r| r.tag == 'patent-use' }
|
328
|
-
expect(rule).
|
328
|
+
expect(rule).not_to be_nil
|
329
329
|
expect(rule.description).to include('does NOT grant')
|
330
330
|
|
331
331
|
expect(gpl.rules).to have_key('permissions')
|
332
332
|
rule = gpl.rules['permissions'].find { |r| r.tag == 'patent-use' }
|
333
|
-
expect(rule).
|
333
|
+
expect(rule).not_to be_nil
|
334
334
|
expect(rule.description).to include('an express grant of patent rights')
|
335
335
|
end
|
336
336
|
|
337
337
|
context 'fields' do
|
338
338
|
it 'returns the license fields' do
|
339
|
-
expect(mit.fields.count).to
|
339
|
+
expect(mit.fields.count).to be(2)
|
340
340
|
expect(mit.fields.first.key).to eql('year')
|
341
341
|
expect(mit.fields.last.key).to eql('fullname')
|
342
342
|
expect(gpl.fields).to be_empty
|
@@ -353,19 +353,19 @@ RSpec.describe Licensee::License do
|
|
353
353
|
it 'returns mustache content' do
|
354
354
|
expect(license.content_for_mustache).to match(/{{{year}}}/)
|
355
355
|
expect(license.content_for_mustache).to match(/{{{fullname}}}/)
|
356
|
-
expect(license.content_for_mustache).
|
357
|
-
expect(license.content_for_mustache).
|
356
|
+
expect(license.content_for_mustache).not_to match(/\[year\]/)
|
357
|
+
expect(license.content_for_mustache).not_to match(/\[fullname\]/)
|
358
358
|
end
|
359
359
|
|
360
360
|
it "doesn't mangle other fields" do
|
361
361
|
expect(license.content_for_mustache).to match(/\[foo\]/)
|
362
|
-
expect(license.content_for_mustache).
|
362
|
+
expect(license.content_for_mustache).not_to match(/{{{foo}}}/)
|
363
363
|
end
|
364
364
|
end
|
365
365
|
end
|
366
366
|
|
367
367
|
context 'License.title_regex' do
|
368
|
-
|
368
|
+
described_class.all(hidden: true, pseudo: false).each do |license|
|
369
369
|
context "the #{license.title} license" do
|
370
370
|
%i[title nickname key].each do |variation|
|
371
371
|
next if license.send(variation).nil?
|
@@ -440,7 +440,7 @@ RSpec.describe Licensee::License do
|
|
440
440
|
|
441
441
|
context 'a license with an alt title' do
|
442
442
|
let(:text) { 'The Clear BSD license' }
|
443
|
-
let(:license) {
|
443
|
+
let(:license) { described_class.find('bsd-3-clause-clear') }
|
444
444
|
|
445
445
|
it 'matches' do
|
446
446
|
expect(text).to match(license.title_regex)
|
@@ -475,7 +475,7 @@ RSpec.describe Licensee::License do
|
|
475
475
|
end
|
476
476
|
|
477
477
|
context 'source regex' do
|
478
|
-
|
478
|
+
described_class.all(hidden: true, pseudo: false).each do |license|
|
479
479
|
context "the #{license.title} license" do
|
480
480
|
let(:source) { URI.parse(license.source) }
|
481
481
|
|
@@ -1,18 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
RSpec.describe Licensee::Matchers::Cabal do
|
4
|
+
subject { described_class.new(file) }
|
5
|
+
|
4
6
|
let(:content) { 'license: mit' }
|
5
7
|
let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE.txt') }
|
6
8
|
let(:mit) { Licensee::License.find('mit') }
|
7
9
|
let(:no_license) { Licensee::License.find('no-license') }
|
8
|
-
subject { described_class.new(file) }
|
9
10
|
|
10
11
|
it 'matches' do
|
11
12
|
expect(subject.match).to eql(mit)
|
12
13
|
end
|
13
14
|
|
14
15
|
it 'has a confidence' do
|
15
|
-
expect(subject.confidence).to
|
16
|
+
expect(subject.confidence).to be(90)
|
16
17
|
end
|
17
18
|
|
18
19
|
{
|
@@ -31,6 +32,7 @@ RSpec.describe Licensee::Matchers::Cabal do
|
|
31
32
|
|
32
33
|
context 'non-standard license format' do
|
33
34
|
let(:content) { "license: #{cabal_license}" }
|
35
|
+
|
34
36
|
context 'GPL-3' do
|
35
37
|
let(:cabal_license) { 'GPL-3' }
|
36
38
|
|
@@ -1,17 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
RSpec.describe Licensee::Matchers::Cargo do
|
4
|
+
subject { described_class.new(file) }
|
5
|
+
|
4
6
|
let(:mit) { Licensee::License.find('mit') }
|
5
7
|
let(:content) { 'license = "MIT"' }
|
6
8
|
let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'Cargo.toml') }
|
7
|
-
subject { described_class.new(file) }
|
8
9
|
|
9
10
|
it 'stores the file' do
|
10
11
|
expect(subject.file).to eql(file)
|
11
12
|
end
|
12
13
|
|
13
14
|
it 'has confidence' do
|
14
|
-
expect(subject.confidence).to
|
15
|
+
expect(subject.confidence).to be(90)
|
15
16
|
end
|
16
17
|
|
17
18
|
it 'matches' do
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
RSpec.describe Licensee::Matchers::Copyright do
|
4
|
+
subject { described_class.new(file) }
|
5
|
+
|
4
6
|
let(:content) { 'Copyright 2015 Ben Balter'.dup }
|
5
7
|
let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE.txt') }
|
6
8
|
let(:mit) { Licensee::License.find('mit') }
|
7
9
|
let(:no_license) { Licensee::License.find('no-license') }
|
8
10
|
|
9
|
-
subject { described_class.new(file) }
|
10
|
-
|
11
11
|
it 'stores the file' do
|
12
12
|
expect(subject.file).to eql(file)
|
13
13
|
end
|
@@ -17,7 +17,7 @@ RSpec.describe Licensee::Matchers::Copyright do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'has a confidence' do
|
20
|
-
expect(subject.confidence).to
|
20
|
+
expect(subject.confidence).to be(100)
|
21
21
|
end
|
22
22
|
|
23
23
|
{
|
@@ -1,12 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
RSpec.describe Licensee::Matchers::Cran do
|
4
|
+
subject { described_class.new(file) }
|
5
|
+
|
4
6
|
let(:mit) { Licensee::License.find('mit') }
|
5
7
|
let(:gpl2) { Licensee::License.find('gpl-2.0') }
|
6
8
|
let(:gpl3) { Licensee::License.find('gpl-3.0') }
|
7
9
|
let(:content) { "License: MIT + file LICENSE\nPackage: test" }
|
8
10
|
let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'DESCRIPTION') }
|
9
|
-
subject { described_class.new(file) }
|
10
11
|
|
11
12
|
it 'stores the file' do
|
12
13
|
expect(subject.file).to eql(file)
|
@@ -17,7 +18,7 @@ RSpec.describe Licensee::Matchers::Cran do
|
|
17
18
|
end
|
18
19
|
|
19
20
|
it 'is confident' do
|
20
|
-
expect(subject.confidence).to
|
21
|
+
expect(subject.confidence).to be(90)
|
21
22
|
end
|
22
23
|
|
23
24
|
{
|