licensee 9.10.0 → 9.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/bin/licensee +5 -4
  3. data/lib/licensee.rb +4 -2
  4. data/lib/licensee/commands/detect.rb +10 -5
  5. data/lib/licensee/commands/diff.rb +7 -8
  6. data/lib/licensee/commands/license_path.rb +2 -0
  7. data/lib/licensee/commands/version.rb +2 -0
  8. data/lib/licensee/content_helper.rb +234 -85
  9. data/lib/licensee/hash_helper.rb +7 -5
  10. data/lib/licensee/license.rb +32 -25
  11. data/lib/licensee/license_field.rb +4 -1
  12. data/lib/licensee/license_meta.rb +3 -0
  13. data/lib/licensee/license_rules.rb +2 -0
  14. data/lib/licensee/matchers.rb +2 -0
  15. data/lib/licensee/matchers/cabal.rb +16 -2
  16. data/lib/licensee/matchers/cargo.rb +3 -1
  17. data/lib/licensee/matchers/copyright.rb +6 -4
  18. data/lib/licensee/matchers/cran.rb +7 -3
  19. data/lib/licensee/matchers/dice.rb +6 -4
  20. data/lib/licensee/matchers/dist_zilla.rb +3 -1
  21. data/lib/licensee/matchers/exact.rb +3 -0
  22. data/lib/licensee/matchers/gemspec.rb +8 -5
  23. data/lib/licensee/matchers/matcher.rb +3 -1
  24. data/lib/licensee/matchers/npm_bower.rb +3 -1
  25. data/lib/licensee/matchers/package.rb +3 -0
  26. data/lib/licensee/matchers/reference.rb +3 -1
  27. data/lib/licensee/matchers/spdx.rb +3 -1
  28. data/lib/licensee/project_files.rb +2 -0
  29. data/lib/licensee/project_files/license_file.rb +13 -10
  30. data/lib/licensee/project_files/package_manager_file.rb +3 -0
  31. data/lib/licensee/project_files/project_file.rb +12 -4
  32. data/lib/licensee/project_files/readme_file.rb +5 -3
  33. data/lib/licensee/projects.rb +2 -0
  34. data/lib/licensee/projects/fs_project.rb +3 -0
  35. data/lib/licensee/projects/git_project.rb +19 -11
  36. data/lib/licensee/projects/github_project.rb +6 -1
  37. data/lib/licensee/projects/project.rb +16 -5
  38. data/lib/licensee/rule.rb +2 -0
  39. data/lib/licensee/version.rb +3 -1
  40. data/licensee.gemspec +47 -0
  41. data/spec/bin_spec.rb +3 -1
  42. data/spec/fixture_spec.rb +46 -0
  43. data/spec/fixtures/bsd-3-noendorseslash/LICENSE +30 -0
  44. data/spec/fixtures/cc0-cal2013/LICENSE +116 -0
  45. data/spec/fixtures/cc0-cc/LICENSE +121 -0
  46. data/spec/fixtures/detect.json +9 -7
  47. data/spec/fixtures/fixtures.yml +130 -0
  48. data/spec/fixtures/html/license.html +262 -0
  49. data/spec/fixtures/license-hashes.json +41 -0
  50. data/spec/fixtures/mit-optional/LICENSE.txt +21 -0
  51. data/spec/fixtures/multiple-arrs/LICENSE +30 -0
  52. data/spec/fixtures/unlicense-noinfo/LICENSE +22 -0
  53. data/spec/integration_spec.rb +68 -2
  54. data/spec/licensee/commands/detect_spec.rb +10 -6
  55. data/spec/licensee/commands/license_path_spec.rb +3 -1
  56. data/spec/licensee/commands/version_spec.rb +3 -1
  57. data/spec/licensee/content_helper_spec.rb +184 -67
  58. data/spec/licensee/hash_helper_spec.rb +3 -1
  59. data/spec/licensee/license_field_spec.rb +5 -3
  60. data/spec/licensee/license_meta_spec.rb +16 -12
  61. data/spec/licensee/license_rules_spec.rb +6 -2
  62. data/spec/licensee/license_spec.rb +62 -37
  63. data/spec/licensee/matchers/cabal_matcher_spec.rb +97 -2
  64. data/spec/licensee/matchers/cargo_matcher_spec.rb +5 -2
  65. data/spec/licensee/matchers/copyright_matcher_spec.rb +7 -5
  66. data/spec/licensee/matchers/cran_matcher_spec.rb +5 -2
  67. data/spec/licensee/matchers/dice_matcher_spec.rb +15 -12
  68. data/spec/licensee/matchers/dist_zilla_matcher_spec.rb +5 -2
  69. data/spec/licensee/matchers/exact_matcher_spec.rb +5 -2
  70. data/spec/licensee/matchers/gemspec_matcher_spec.rb +5 -2
  71. data/spec/licensee/matchers/matcher_spec.rb +6 -2
  72. data/spec/licensee/matchers/npm_bower_matcher_spec.rb +5 -3
  73. data/spec/licensee/matchers/package_matcher_spec.rb +6 -2
  74. data/spec/licensee/matchers/reference_matcher_spec.rb +4 -2
  75. data/spec/licensee/matchers/spdx_matcher_spec.rb +5 -2
  76. data/spec/licensee/project_files/license_file_spec.rb +20 -18
  77. data/spec/licensee/project_files/package_info_spec.rb +5 -1
  78. data/spec/licensee/project_files/project_file_spec.rb +8 -2
  79. data/spec/licensee/project_files/readme_file_spec.rb +4 -1
  80. data/spec/licensee/project_spec.rb +24 -17
  81. data/spec/licensee/projects/git_project_spec.rb +23 -0
  82. data/spec/licensee/projects/github_project_spec.rb +8 -5
  83. data/spec/licensee/rule_spec.rb +6 -3
  84. data/spec/licensee_spec.rb +12 -9
  85. data/spec/spec_helper.rb +28 -9
  86. data/spec/vendored_license_spec.rb +29 -10
  87. data/vendor/choosealicense.com/_data/meta.yml +0 -4
  88. data/vendor/choosealicense.com/_data/rules.yml +3 -0
  89. data/vendor/choosealicense.com/_licenses/0bsd.txt +39 -0
  90. data/vendor/choosealicense.com/_licenses/afl-3.0.txt +7 -6
  91. data/vendor/choosealicense.com/_licenses/agpl-3.0.txt +0 -1
  92. data/vendor/choosealicense.com/_licenses/apache-2.0.txt +1 -2
  93. data/vendor/choosealicense.com/_licenses/artistic-2.0.txt +1 -2
  94. data/vendor/choosealicense.com/_licenses/bsd-2-clause.txt +8 -6
  95. data/vendor/choosealicense.com/_licenses/bsd-3-clause-clear.txt +2 -2
  96. data/vendor/choosealicense.com/_licenses/bsd-3-clause.txt +12 -10
  97. data/vendor/choosealicense.com/_licenses/bsd-4-clause.txt +61 -0
  98. data/vendor/choosealicense.com/_licenses/bsl-1.0.txt +5 -2
  99. data/vendor/choosealicense.com/_licenses/cc-by-4.0.txt +3 -1
  100. data/vendor/choosealicense.com/_licenses/cc-by-sa-4.0.txt +3 -1
  101. data/vendor/choosealicense.com/_licenses/cc0-1.0.txt +113 -105
  102. data/vendor/choosealicense.com/_licenses/cecill-2.1.txt +579 -0
  103. data/vendor/choosealicense.com/_licenses/ecl-2.0.txt +1 -2
  104. data/vendor/choosealicense.com/_licenses/epl-1.0.txt +1 -2
  105. data/vendor/choosealicense.com/_licenses/epl-2.0.txt +3 -4
  106. data/vendor/choosealicense.com/_licenses/eupl-1.1.txt +0 -1
  107. data/vendor/choosealicense.com/_licenses/eupl-1.2.txt +0 -1
  108. data/vendor/choosealicense.com/_licenses/gpl-2.0.txt +0 -1
  109. data/vendor/choosealicense.com/_licenses/gpl-3.0.txt +1 -2
  110. data/vendor/choosealicense.com/_licenses/isc.txt +0 -1
  111. data/vendor/choosealicense.com/_licenses/lgpl-2.1.txt +0 -1
  112. data/vendor/choosealicense.com/_licenses/lgpl-3.0.txt +1 -3
  113. data/vendor/choosealicense.com/_licenses/lppl-1.3c.txt +1 -2
  114. data/vendor/choosealicense.com/_licenses/mit.txt +1 -2
  115. data/vendor/choosealicense.com/_licenses/mpl-2.0.txt +0 -1
  116. data/vendor/choosealicense.com/_licenses/ms-pl.txt +0 -1
  117. data/vendor/choosealicense.com/_licenses/ms-rl.txt +0 -1
  118. data/vendor/choosealicense.com/_licenses/ncsa.txt +21 -22
  119. data/vendor/choosealicense.com/_licenses/odbl-1.0.txt +573 -0
  120. data/vendor/choosealicense.com/_licenses/ofl-1.1.txt +4 -2
  121. data/vendor/choosealicense.com/_licenses/osl-3.0.txt +1 -2
  122. data/vendor/choosealicense.com/_licenses/postgresql.txt +4 -5
  123. data/vendor/choosealicense.com/_licenses/unlicense.txt +1 -2
  124. data/vendor/choosealicense.com/_licenses/upl-1.0.txt +4 -5
  125. data/vendor/choosealicense.com/_licenses/vim.txt +111 -0
  126. data/vendor/choosealicense.com/_licenses/wtfpl.txt +0 -1
  127. data/vendor/choosealicense.com/_licenses/zlib.txt +4 -2
  128. metadata +77 -19
@@ -1,15 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Licensee::Matchers::Cargo do
4
+ subject { described_class.new(file) }
5
+
2
6
  let(:mit) { Licensee::License.find('mit') }
3
7
  let(:content) { 'license = "MIT"' }
4
8
  let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'Cargo.toml') }
5
- subject { described_class.new(file) }
6
9
 
7
10
  it 'stores the file' do
8
11
  expect(subject.file).to eql(file)
9
12
  end
10
13
 
11
14
  it 'has confidence' do
12
- expect(subject.confidence).to eql(90)
15
+ expect(subject.confidence).to be(90)
13
16
  end
14
17
 
15
18
  it 'matches' do
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Licensee::Matchers::Copyright do
2
- let(:content) { 'Copyright 2015 Ben Balter' }
4
+ subject { described_class.new(file) }
5
+
6
+ let(:content) { 'Copyright 2015 Ben Balter'.dup }
3
7
  let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE.txt') }
4
8
  let(:mit) { Licensee::License.find('mit') }
5
9
  let(:no_license) { Licensee::License.find('no-license') }
6
10
 
7
- subject { described_class.new(file) }
8
-
9
11
  it 'stores the file' do
10
12
  expect(subject.file).to eql(file)
11
13
  end
@@ -15,7 +17,7 @@ RSpec.describe Licensee::Matchers::Copyright do
15
17
  end
16
18
 
17
19
  it 'has a confidence' do
18
- expect(subject.confidence).to eql(100)
20
+ expect(subject.confidence).to be(100)
19
21
  end
20
22
 
21
23
  {
@@ -28,7 +30,7 @@ RSpec.describe Licensee::Matchers::Copyright do
28
30
  'ASCII-8BIT encoded' => "Copyright \xC2\xA92015 Ben Balter`",
29
31
  'No year' => 'Copyright Ben Balter',
30
32
  'Multiline' => "Copyright Ben Balter\nCopyright Another Entity"
31
- .force_encoding('ASCII-8BIT')
33
+ .dup.force_encoding('ASCII-8BIT')
32
34
  }.each do |description, notice|
33
35
  context "with a #{description} notice" do
34
36
  let(:content) { notice }
@@ -1,10 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Licensee::Matchers::Cran do
4
+ subject { described_class.new(file) }
5
+
2
6
  let(:mit) { Licensee::License.find('mit') }
3
7
  let(:gpl2) { Licensee::License.find('gpl-2.0') }
4
8
  let(:gpl3) { Licensee::License.find('gpl-3.0') }
5
9
  let(:content) { "License: MIT + file LICENSE\nPackage: test" }
6
10
  let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'DESCRIPTION') }
7
- subject { described_class.new(file) }
8
11
 
9
12
  it 'stores the file' do
10
13
  expect(subject.file).to eql(file)
@@ -15,7 +18,7 @@ RSpec.describe Licensee::Matchers::Cran do
15
18
  end
16
19
 
17
20
  it 'is confident' do
18
- expect(subject.confidence).to eql(90)
21
+ expect(subject.confidence).to be(90)
19
22
  end
20
23
 
21
24
  {
@@ -1,4 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Licensee::Matchers::Dice do
4
+ subject { described_class.new(file) }
5
+
2
6
  let(:mit) { Licensee::License.find('mit') }
3
7
  let(:gpl) { Licensee::License.find('gpl-3.0') }
4
8
  let(:agpl) { Licensee::License.find('agpl-3.0') }
@@ -6,7 +10,6 @@ RSpec.describe Licensee::Matchers::Dice do
6
10
  let(:cc_by_sa) { Licensee::License.find('cc-by-sa-4.0') }
7
11
  let(:content) { sub_copyright_info(gpl) }
8
12
  let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE.txt') }
9
- subject { described_class.new(file) }
10
13
 
11
14
  it 'stores the file' do
12
15
  expect(subject.file).to eql(file)
@@ -22,25 +25,25 @@ RSpec.describe Licensee::Matchers::Dice do
22
25
 
23
26
  it 'sorts licenses by similarity' do
24
27
  expect(subject.matches_by_similarity[0]).to eql([gpl, 100.0])
25
- expect(subject.matches_by_similarity[1]).to eql([agpl, 95.76581285938317])
28
+ expect(subject.matches_by_similarity[1]).to eql([agpl, 95.6842105263158])
26
29
  end
27
30
 
28
31
  it 'returns a list of licenses above the confidence threshold' do
29
32
  expect(subject.matches_by_similarity[0]).to eql([gpl, 100.0])
30
- expect(subject.matches_by_similarity[1]).to eql([agpl, 95.76581285938317])
33
+ expect(subject.matches_by_similarity[1]).to eql([agpl, 95.6842105263158])
31
34
  end
32
35
 
33
36
  it 'returns the match confidence' do
34
- expect(subject.confidence).to eql(100.0)
37
+ expect(subject.confidence).to be(100.0)
35
38
  end
36
39
 
37
40
  context 'without a match' do
38
41
  let(:content) { 'Not really a license' }
39
42
 
40
43
  it "doesn't match" do
41
- expect(subject.match).to eql(nil)
44
+ expect(subject.match).to be(nil)
42
45
  expect(subject.matches).to be_empty
43
- expect(subject.confidence).to eql(0)
46
+ expect(subject.confidence).to be(0)
44
47
  end
45
48
  end
46
49
 
@@ -50,10 +53,10 @@ RSpec.describe Licensee::Matchers::Dice do
50
53
  end
51
54
 
52
55
  it "doesn't match" do
53
- expect(content).to_not be_detected_as(gpl)
54
- expect(subject.match).to eql(nil)
56
+ expect(content).not_to be_detected_as(gpl)
57
+ expect(subject.match).to be(nil)
55
58
  expect(subject.matches).to be_empty
56
- expect(subject.confidence).to eql(0)
59
+ expect(subject.confidence).to be(0)
57
60
  end
58
61
  end
59
62
 
@@ -72,11 +75,11 @@ RSpec.describe Licensee::Matchers::Dice do
72
75
  let(:content) { File.read(license_path) }
73
76
 
74
77
  it "doesn't match" do
75
- expect(content).to_not be_detected_as(cc_by)
76
- expect(content).to_not be_detected_as(cc_by_sa)
78
+ expect(content).not_to be_detected_as(cc_by)
79
+ expect(content).not_to be_detected_as(cc_by_sa)
77
80
  expect(subject.match).to be_nil
78
81
  expect(subject.matches).to be_empty
79
- expect(subject.confidence).to eql(0)
82
+ expect(subject.confidence).to be(0)
80
83
  end
81
84
  end
82
85
  end
@@ -1,15 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Licensee::Matchers::DistZilla do
4
+ subject { described_class.new(file) }
5
+
2
6
  let(:mit) { Licensee::License.find('mit') }
3
7
  let(:content) { 'license = MIT' }
4
8
  let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'dist.ini') }
5
- subject { described_class.new(file) }
6
9
 
7
10
  it 'stores the file' do
8
11
  expect(subject.file).to eql(file)
9
12
  end
10
13
 
11
14
  it 'has confidence' do
12
- expect(subject.confidence).to eql(90)
15
+ expect(subject.confidence).to be(90)
13
16
  end
14
17
 
15
18
  it 'matches' do
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Licensee::Matchers::Exact do
4
+ subject { described_class.new(file) }
5
+
2
6
  let(:mit) { Licensee::License.find('mit') }
3
7
  let(:content) { sub_copyright_info(mit) }
4
8
  let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE.txt') }
5
- subject { described_class.new(file) }
6
9
 
7
10
  it 'stores the file' do
8
11
  expect(subject.file).to eql(file)
@@ -13,7 +16,7 @@ RSpec.describe Licensee::Matchers::Exact do
13
16
  end
14
17
 
15
18
  it 'is confident' do
16
- expect(subject.confidence).to eql(100)
19
+ expect(subject.confidence).to be(100)
17
20
  end
18
21
 
19
22
  context 'with extra words added' do
@@ -1,17 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Licensee::Matchers::Gemspec do
4
+ subject { described_class.new(file) }
5
+
2
6
  let(:mit) { Licensee::License.find('mit') }
3
7
  let(:content) { "s.license = 'mit'" }
4
8
  let(:file) do
5
9
  Licensee::ProjectFiles::LicenseFile.new(content, 'project.gemspec')
6
10
  end
7
- subject { described_class.new(file) }
8
11
 
9
12
  it 'matches' do
10
13
  expect(subject.match).to eql(mit)
11
14
  end
12
15
 
13
16
  it 'has confidence' do
14
- expect(subject.confidence).to eql(90)
17
+ expect(subject.confidence).to be(90)
15
18
  end
16
19
 
17
20
  {
@@ -1,15 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Licensee::Matchers::Matcher do
4
+ subject { described_class.new(file) }
5
+
2
6
  let(:mit) { Licensee::License.find('mit') }
3
7
  let(:content) { sub_copyright_info(mit) }
4
8
  let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE.txt') }
5
- subject { described_class.new(file) }
6
9
 
7
10
  it 'stores the file' do
8
11
  expect(subject.file).to eql(file)
9
12
  end
10
13
 
11
14
  it 'returns its name' do
12
- expect(subject.name).to eql(:matcher)
15
+ expect(subject.name).to be(:matcher)
13
16
  end
14
17
 
15
18
  context 'to_h' do
@@ -20,6 +23,7 @@ RSpec.describe Licensee::Matchers::Matcher do
20
23
  end
21
24
 
22
25
  subject { MatcherSpecFixture.new(file) }
26
+
23
27
  let(:hash) { subject.to_h }
24
28
  let(:expected) do
25
29
  {
@@ -1,17 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Licensee::Matchers::NpmBower do
4
+ subject { described_class.new(file) }
5
+
2
6
  let(:content) { '"license": "mit"' }
3
7
  let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE.txt') }
4
8
  let(:mit) { Licensee::License.find('mit') }
5
9
  let(:other) { Licensee::License.find('other') }
6
10
 
7
- subject { described_class.new(file) }
8
-
9
11
  it 'matches' do
10
12
  expect(subject.match).to eql(mit)
11
13
  end
12
14
 
13
15
  it 'has a confidence' do
14
- expect(subject.confidence).to eql(90)
16
+ expect(subject.confidence).to be(90)
15
17
  end
16
18
 
17
19
  {
@@ -1,11 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Licensee::Matchers::Package do
4
+ subject { described_class.new(file) }
5
+
2
6
  let(:mit) { Licensee::License.find('mit') }
3
7
  let(:content) { '' }
4
8
  let(:file) do
5
9
  Licensee::ProjectFiles::LicenseFile.new(content, 'project.gemspec')
6
10
  end
7
11
  let(:license_property) { 'mit' }
8
- subject { described_class.new(file) }
12
+
9
13
  before do
10
14
  allow(subject).to receive(:license_property).and_return(license_property)
11
15
  end
@@ -15,7 +19,7 @@ RSpec.describe Licensee::Matchers::Package do
15
19
  end
16
20
 
17
21
  it 'has confidence' do
18
- expect(subject.confidence).to eql(90)
22
+ expect(subject.confidence).to be(90)
19
23
  end
20
24
 
21
25
  context 'with a nil license property' do
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Licensee::Matchers::Reference do
4
+ subject { described_class.new(file) }
5
+
2
6
  let(:content) { 'Copyright 2015 Ben Balter' }
3
7
  let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE.txt') }
4
8
  let(:license) { Licensee::License.find('gpl-3.0') }
5
9
 
6
- subject { described_class.new(file) }
7
-
8
10
  %i[title key nickname].each do |variation|
9
11
  context "with a license #{variation}" do
10
12
  let(:content) { "Licensed under the #{license.send(variation)} license" }
@@ -1,18 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Licensee::Matchers::Spdx do
4
+ subject { described_class.new(file) }
5
+
2
6
  let(:content) { 'PackageLicenseDeclared: MIT' }
3
7
  let(:file) do
4
8
  Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE.spdx')
5
9
  end
6
10
  let(:mit) { Licensee::License.find('mit') }
7
11
  let(:other) { Licensee::License.find('other') }
8
- subject { described_class.new(file) }
9
12
 
10
13
  it 'matches' do
11
14
  expect(subject.match).to eql(mit)
12
15
  end
13
16
 
14
17
  it 'has a confidence' do
15
- expect(subject.confidence).to eql(90)
18
+ expect(subject.confidence).to be(90)
16
19
  end
17
20
 
18
21
  context 'no license field' do
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Licensee::ProjectFiles::LicenseFile do
4
+ subject { described_class.new(content, filename) }
5
+
2
6
  let(:filename) { 'LICENSE.txt' }
3
7
  let(:gpl) { Licensee::License.find('gpl-3.0') }
4
8
  let(:mit) { Licensee::License.find('mit') }
5
9
  let(:content) { sub_copyright_info(mit) }
6
- let(:content_hash) { '46cdc03462b9af57968df67b450cc4372ac41f53' }
7
-
8
- subject { described_class.new(content, filename) }
10
+ let(:content_hash) { license_hashes['mit'] }
9
11
 
10
12
  it 'parses the attribution' do
11
13
  expect(subject.attribution).to eql('Copyright (c) 2018 Ben Balter')
@@ -20,7 +22,7 @@ RSpec.describe Licensee::ProjectFiles::LicenseFile do
20
22
  end
21
23
 
22
24
  context 'with an non-UTF-8-encoded license' do
23
- let(:content) { "\x91License\x93".force_encoding('windows-1251') }
25
+ let(:content) { "\x91License\x93".dup.force_encoding('windows-1251') }
24
26
 
25
27
  it "doesn't blow up " do
26
28
  expect(subject.attribution).to be_nil
@@ -45,7 +47,7 @@ RSpec.describe Licensee::ProjectFiles::LicenseFile do
45
47
  end
46
48
 
47
49
  it 'creates the wordset' do
48
- expect(subject.wordset.count).to eql(91)
50
+ expect(subject.wordset.count).to be(92)
49
51
  expect(subject.wordset.first).to eql('permission')
50
52
  end
51
53
 
@@ -117,11 +119,11 @@ RSpec.describe Licensee::ProjectFiles::LicenseFile do
117
119
  end
118
120
 
119
121
  it 'does not match .md2' do
120
- expect(described_class::PREFERRED_EXT_REGEX).to_not match('.md2')
122
+ expect(described_class::PREFERRED_EXT_REGEX).not_to match('.md2')
121
123
  end
122
124
 
123
125
  it 'does not match .md/foo' do
124
- expect(described_class::PREFERRED_EXT_REGEX).to_not match('.md/foo')
126
+ expect(described_class::PREFERRED_EXT_REGEX).not_to match('.md/foo')
125
127
  end
126
128
  end
127
129
 
@@ -131,7 +133,7 @@ RSpec.describe Licensee::ProjectFiles::LicenseFile do
131
133
  end
132
134
 
133
135
  it 'does not match .md/foo' do
134
- expect(described_class::OTHER_EXT_REGEX).to_not match('.md/foo')
136
+ expect(described_class::OTHER_EXT_REGEX).not_to match('.md/foo')
135
137
  end
136
138
  end
137
139
 
@@ -156,11 +158,11 @@ RSpec.describe Licensee::ProjectFiles::LicenseFile do
156
158
  let(:regex) { Licensee::ProjectFiles::LicenseFile::CC_FALSE_POSITIVE_REGEX }
157
159
 
158
160
  it "knows MIT isn't a potential false positive" do
159
- expect(subject.content).to_not match(regex)
160
- expect(subject).to_not be_a_potential_false_positive
161
+ expect(subject.content).not_to match(regex)
162
+ expect(subject).not_to be_a_potential_false_positive
161
163
  end
162
164
 
163
- context 'a CC false positive without creative commons in the title' do
165
+ context 'a CC false positive with creative commons in the title' do
164
166
  let(:content) { 'Creative Commons Attribution-NonCommercial 4.0' }
165
167
 
166
168
  it "knows it's a potential false positive" do
@@ -189,10 +191,10 @@ RSpec.describe Licensee::ProjectFiles::LicenseFile do
189
191
 
190
192
  context 'CC-BY-ND with leading instructions' do
191
193
  let(:content) do
192
- <<-LICENSE
193
- Creative Commons Corporation ("Creative Commons") is not a law firm
194
- ======================================================================
195
- Creative Commons Attribution-NonCommercial 4.0
194
+ <<~LICENSE
195
+ Creative Commons Corporation ("Creative Commons") is not a law firm
196
+ ======================================================================
197
+ Creative Commons Attribution-NonCommercial 4.0
196
198
  LICENSE
197
199
  end
198
200
 
@@ -218,7 +220,7 @@ Creative Commons Attribution-NonCommercial 4.0
218
220
  let(:content) { sub_copyright_info(mit) }
219
221
 
220
222
  it 'is not lgpl' do
221
- expect(subject).to_not be_lgpl
223
+ expect(subject).not_to be_lgpl
222
224
  end
223
225
  end
224
226
  end
@@ -227,7 +229,7 @@ Creative Commons Attribution-NonCommercial 4.0
227
229
  let(:filename) { 'COPYING' }
228
230
 
229
231
  it 'is not lgpl' do
230
- expect(subject).to_not be_lgpl
232
+ expect(subject).not_to be_lgpl
231
233
  end
232
234
  end
233
235
  end
@@ -243,7 +245,7 @@ Creative Commons Attribution-NonCommercial 4.0
243
245
  let(:content) { sub_copyright_info(mit) }
244
246
 
245
247
  it 'is not GPL' do
246
- expect(subject).to_not be_gpl
248
+ expect(subject).not_to be_gpl
247
249
  end
248
250
  end
249
251
  end