licensee 9.13.1 → 9.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +1 -1
  3. data/bin/licensee +1 -1
  4. data/lib/licensee.rb +4 -4
  5. data/lib/licensee/commands/detect.rb +3 -5
  6. data/lib/licensee/commands/diff.rb +3 -5
  7. data/lib/licensee/content_helper.rb +46 -42
  8. data/lib/licensee/hash_helper.rb +1 -1
  9. data/lib/licensee/license.rb +29 -15
  10. data/lib/licensee/matchers.rb +1 -0
  11. data/lib/licensee/matchers/cabal.rb +1 -1
  12. data/lib/licensee/matchers/cargo.rb +1 -1
  13. data/lib/licensee/matchers/copyright.rb +3 -8
  14. data/lib/licensee/matchers/cran.rb +1 -1
  15. data/lib/licensee/matchers/dice.rb +2 -2
  16. data/lib/licensee/matchers/dist_zilla.rb +1 -1
  17. data/lib/licensee/matchers/gemspec.rb +4 -4
  18. data/lib/licensee/matchers/npm_bower.rb +5 -2
  19. data/lib/licensee/matchers/nuget.rb +43 -0
  20. data/lib/licensee/matchers/spdx.rb +1 -1
  21. data/lib/licensee/project_files/license_file.rb +29 -22
  22. data/lib/licensee/project_files/package_manager_file.rb +3 -2
  23. data/lib/licensee/project_files/project_file.rb +3 -4
  24. data/lib/licensee/project_files/readme_file.rb +1 -1
  25. data/lib/licensee/projects/fs_project.rb +8 -5
  26. data/lib/licensee/projects/git_project.rb +6 -4
  27. data/lib/licensee/projects/github_project.rb +1 -1
  28. data/lib/licensee/projects/project.rb +11 -10
  29. data/lib/licensee/version.rb +1 -1
  30. data/licensee.gemspec +7 -8
  31. data/spec/fixture_spec.rb +3 -3
  32. data/spec/fixtures/bom/LICENSE.txt +21 -0
  33. data/spec/fixtures/bsd-3-authorowner/LICENSE +27 -0
  34. data/spec/fixtures/cc-by-sa-mdlinks/License.md +173 -0
  35. data/spec/fixtures/cc-by-sa-nocclicensor/License.md +425 -0
  36. data/spec/fixtures/crlf-bsd/LICENSE.md +27 -0
  37. data/spec/fixtures/detect.json +16 -22
  38. data/spec/fixtures/eupl-cal2017/LICENSE.txt +274 -0
  39. data/spec/fixtures/fixtures.yml +62 -22
  40. data/spec/fixtures/license-hashes.json +39 -38
  41. data/spec/fixtures/markdown-artistic/LICENSE.md +192 -0
  42. data/spec/fixtures/pixar-modified-apache/LICENSE.txt +174 -0
  43. data/spec/fixtures/readme-invalid-encoding/README.md +24 -0
  44. data/spec/fixtures/vim/LICENSE +78 -0
  45. data/spec/integration_spec.rb +86 -9
  46. data/spec/licensee/commands/detect_spec.rb +2 -2
  47. data/spec/licensee/content_helper_spec.rb +21 -21
  48. data/spec/licensee/hash_helper_spec.rb +22 -22
  49. data/spec/licensee/license_meta_spec.rb +5 -11
  50. data/spec/licensee/license_spec.rb +14 -10
  51. data/spec/licensee/matchers/dice_matcher_spec.rb +4 -11
  52. data/spec/licensee/matchers/matcher_spec.rb +6 -6
  53. data/spec/licensee/matchers/npm_bower_matcher_spec.rb +9 -0
  54. data/spec/licensee/matchers/nu_get_matcher_spec.rb +91 -0
  55. data/spec/licensee/project_files/license_file_spec.rb +34 -27
  56. data/spec/licensee/project_files/package_info_spec.rb +8 -0
  57. data/spec/licensee/project_spec.rb +1 -3
  58. data/spec/licensee/rule_spec.rb +1 -1
  59. data/spec/licensee_spec.rb +1 -1
  60. data/spec/spec_helper.rb +3 -3
  61. data/spec/vendored_license_spec.rb +2 -2
  62. data/vendor/choosealicense.com/_data/meta.yml +1 -1
  63. data/vendor/choosealicense.com/_data/rules.yml +13 -13
  64. data/vendor/choosealicense.com/_licenses/0bsd.txt +3 -3
  65. data/vendor/choosealicense.com/_licenses/apache-2.0.txt +3 -3
  66. data/vendor/choosealicense.com/_licenses/bsd-2-clause.txt +3 -3
  67. data/vendor/choosealicense.com/_licenses/bsd-3-clause.txt +3 -3
  68. data/vendor/choosealicense.com/_licenses/bsd-4-clause.txt +3 -3
  69. data/vendor/choosealicense.com/_licenses/bsl-1.0.txt +3 -3
  70. data/vendor/choosealicense.com/_licenses/cc-by-4.0.txt +16 -16
  71. data/vendor/choosealicense.com/_licenses/cc-by-sa-4.0.txt +16 -16
  72. data/vendor/choosealicense.com/_licenses/cc0-1.0.txt +3 -3
  73. data/vendor/choosealicense.com/_licenses/cecill-2.1.txt +3 -3
  74. data/vendor/choosealicense.com/_licenses/ecl-2.0.txt +3 -3
  75. data/vendor/choosealicense.com/_licenses/epl-1.0.txt +3 -3
  76. data/vendor/choosealicense.com/_licenses/epl-2.0.txt +3 -3
  77. data/vendor/choosealicense.com/_licenses/eupl-1.2.txt +77 -60
  78. data/vendor/choosealicense.com/_licenses/gpl-2.0.txt +3 -3
  79. data/vendor/choosealicense.com/_licenses/gpl-3.0.txt +3 -3
  80. data/vendor/choosealicense.com/_licenses/isc.txt +3 -3
  81. data/vendor/choosealicense.com/_licenses/mit-0.txt +45 -0
  82. data/vendor/choosealicense.com/_licenses/mit.txt +3 -3
  83. data/vendor/choosealicense.com/_licenses/mpl-2.0.txt +3 -3
  84. data/vendor/choosealicense.com/_licenses/ncsa.txt +3 -3
  85. data/vendor/choosealicense.com/_licenses/odbl-1.0.txt +3 -3
  86. data/vendor/choosealicense.com/_licenses/ofl-1.1.txt +3 -3
  87. data/vendor/choosealicense.com/_licenses/osl-3.0.txt +3 -3
  88. data/vendor/choosealicense.com/_licenses/postgresql.txt +3 -3
  89. data/vendor/choosealicense.com/_licenses/unlicense.txt +3 -3
  90. data/vendor/choosealicense.com/_licenses/upl-1.0.txt +3 -3
  91. data/vendor/choosealicense.com/_licenses/vim.txt +3 -3
  92. data/vendor/choosealicense.com/_licenses/zlib.txt +3 -3
  93. data/vendor/license-list-XML/src/0BSD.xml +21 -0
  94. data/vendor/license-list-XML/src/AFL-3.0.xml +212 -0
  95. data/vendor/license-list-XML/src/AGPL-3.0.xml +852 -0
  96. data/vendor/license-list-XML/src/Apache-2.0.xml +223 -0
  97. data/vendor/license-list-XML/src/Artistic-2.0.xml +238 -0
  98. data/vendor/license-list-XML/src/BSD-2-Clause.xml +42 -0
  99. data/vendor/license-list-XML/src/BSD-3-Clause-Clear.xml +59 -0
  100. data/vendor/license-list-XML/src/BSD-3-Clause.xml +46 -0
  101. data/vendor/license-list-XML/src/BSD-4-Clause.xml +59 -0
  102. data/vendor/license-list-XML/src/BSL-1.0.xml +30 -0
  103. data/vendor/license-list-XML/src/CC-BY-4.0.xml +444 -0
  104. data/vendor/license-list-XML/src/CC-BY-SA-4.0.xml +475 -0
  105. data/vendor/license-list-XML/src/CC0-1.0.xml +153 -0
  106. data/vendor/license-list-XML/src/CECILL-2.1.xml +669 -0
  107. data/vendor/license-list-XML/src/ECL-2.0.xml +242 -0
  108. data/vendor/license-list-XML/src/EPL-1.0.xml +255 -0
  109. data/vendor/license-list-XML/src/EPL-2.0.xml +639 -0
  110. data/vendor/license-list-XML/src/EUPL-1.1.xml +337 -0
  111. data/vendor/license-list-XML/src/EUPL-1.2.xml +502 -0
  112. data/vendor/license-list-XML/src/GPL-2.0.xml +474 -0
  113. data/vendor/license-list-XML/src/GPL-3.0.xml +858 -0
  114. data/vendor/license-list-XML/src/ISC.xml +29 -0
  115. data/vendor/license-list-XML/src/LGPL-2.1.xml +662 -0
  116. data/vendor/license-list-XML/src/LGPL-3.0.xml +260 -0
  117. data/vendor/license-list-XML/src/LPPL-1.3c.xml +380 -0
  118. data/vendor/license-list-XML/src/MIT-0.xml +40 -0
  119. data/vendor/license-list-XML/src/MIT.xml +32 -0
  120. data/vendor/license-list-XML/src/MPL-2.0.xml +438 -0
  121. data/vendor/license-list-XML/src/MS-PL.xml +89 -0
  122. data/vendor/license-list-XML/src/MS-RL.xml +97 -0
  123. data/vendor/license-list-XML/src/NCSA.xml +60 -0
  124. data/vendor/license-list-XML/src/ODbL-1.0.xml +660 -0
  125. data/vendor/license-list-XML/src/OFL-1.1.xml +94 -0
  126. data/vendor/license-list-XML/src/OSL-3.0.xml +209 -0
  127. data/vendor/license-list-XML/src/PostgreSQL.xml +32 -0
  128. data/vendor/license-list-XML/src/UPL-1.0.xml +46 -0
  129. data/vendor/license-list-XML/src/Unlicense.xml +27 -0
  130. data/vendor/license-list-XML/src/Vim.xml +124 -0
  131. data/vendor/license-list-XML/src/WTFPL.xml +30 -0
  132. data/vendor/license-list-XML/src/Zlib.xml +38 -0
  133. metadata +97 -32
@@ -0,0 +1,78 @@
1
+ VIM LICENSE
2
+
3
+ I) There are no restrictions on distributing unmodified copies of Vim except
4
+ that they must include this license text. You can also distribute
5
+ unmodified parts of Vim, likewise unrestricted except that they must
6
+ include this license text. You are also allowed to include executables
7
+ that you made from the unmodified Vim sources, plus your own usage
8
+ examples and Vim scripts.
9
+
10
+ II) It is allowed to distribute a modified (or extended) version of Vim,
11
+ including executables and/or source code, when the following four
12
+ conditions are met:
13
+ 1) This license text must be included unmodified.
14
+ 2) The modified Vim must be distributed in one of the following five ways:
15
+ a) If you make changes to Vim yourself, you must clearly describe in
16
+ the distribution how to contact you. When the maintainer asks you
17
+ (in any way) for a copy of the modified Vim you distributed, you
18
+ must make your changes, including source code, available to the
19
+ maintainer without fee. The maintainer reserves the right to
20
+ include your changes in the official version of Vim. What the
21
+ maintainer will do with your changes and under what license they
22
+ will be distributed is negotiable. If there has been no negotiation
23
+ then this license, or a later version, also applies to your changes.
24
+ The current maintainer is Bram Moolenaar <Bram@vim.org>. If this
25
+ changes it will be announced in appropriate places (most likely
26
+ vim.sf.net, www.vim.org and/or comp.editors). When it is completely
27
+ impossible to contact the maintainer, the obligation to send him
28
+ your changes ceases. Once the maintainer has confirmed that he has
29
+ received your changes they will not have to be sent again.
30
+ b) If you have received a modified Vim that was distributed as
31
+ mentioned under a) you are allowed to further distribute it
32
+ unmodified, as mentioned at I). If you make additional changes the
33
+ text under a) applies to those changes.
34
+ c) Provide all the changes, including source code, with every copy of
35
+ the modified Vim you distribute. This may be done in the form of a
36
+ context diff. You can choose what license to use for new code you
37
+ add. The changes and their license must not restrict others from
38
+ making their own changes to the official version of Vim.
39
+ d) When you have a modified Vim which includes changes as mentioned
40
+ under c), you can distribute it without the source code for the
41
+ changes if the following three conditions are met:
42
+ - The license that applies to the changes permits you to distribute
43
+ the changes to the Vim maintainer without fee or restriction, and
44
+ permits the Vim maintainer to include the changes in the official
45
+ version of Vim without fee or restriction.
46
+ - You keep the changes for at least three years after last
47
+ distributing the corresponding modified Vim. When the maintainer
48
+ or someone who you distributed the modified Vim to asks you (in
49
+ any way) for the changes within this period, you must make them
50
+ available to him.
51
+ - You clearly describe in the distribution how to contact you. This
52
+ contact information must remain valid for at least three years
53
+ after last distributing the corresponding modified Vim, or as long
54
+ as possible.
55
+ e) When the GNU General Public License (GPL) applies to the changes,
56
+ you can distribute the modified Vim under the GNU GPL version 2 or
57
+ any later version.
58
+ 3) A message must be added, at least in the output of the ":version"
59
+ command and in the intro screen, such that the user of the modified Vim
60
+ is able to see that it was modified. When distributing as mentioned
61
+ under 2)e) adding the message is only required for as far as this does
62
+ not conflict with the license used for the changes.
63
+ 4) The contact information as required under 2)a) and 2)d) must not be
64
+ removed or changed, except that the person himself can make
65
+ corrections.
66
+
67
+ III) If you distribute a modified version of Vim, you are encouraged to use
68
+ the Vim license for your changes and make them available to the
69
+ maintainer, including the source code. The preferred way to do this is
70
+ by e-mail or by uploading the files to a server and e-mailing the URL.
71
+ If the number of changes is small (e.g., a modified Makefile) e-mailing a
72
+ context diff will do. The e-mail address to be used is
73
+ <maintainer@vim.org>
74
+
75
+ IV) It is not allowed to remove this license from the distribution of the Vim
76
+ sources, parts of it or from a modified version. You may use this
77
+ license for previous Vim releases instead of the license that they came
78
+ with, at your option.
@@ -6,7 +6,7 @@ RSpec.describe 'integration test' do
6
6
  Licensee::Projects::GitProject
7
7
  ].each do |project_type|
8
8
  context "with a #{project_type} project" do
9
- subject { project_type.new(project_path, arguments) }
9
+ subject { project_type.new(project_path, **arguments) }
10
10
 
11
11
  let(:filename) { 'LICENSE' }
12
12
  let(:license) { Licensee::License.find('mit') }
@@ -40,9 +40,7 @@ RSpec.describe 'integration test' do
40
40
 
41
41
  before do
42
42
  File.write(file_path, 'bar')
43
- if project_type == Licensee::Projects::GitProject
44
- git_init(project_path)
45
- end
43
+ git_init(project_path) if project_type == Licensee::Projects::GitProject
46
44
  end
47
45
 
48
46
  after { FileUtils.rm_rf(project_path) }
@@ -107,6 +105,14 @@ RSpec.describe 'integration test' do
107
105
  end
108
106
  end
109
107
 
108
+ context 'with Pixar Modified Apache 2.0' do
109
+ let(:fixture) { 'pixar-modified-apache' }
110
+
111
+ it 'matches other' do
112
+ expect(subject.license).to eql(other_license)
113
+ end
114
+ end
115
+
110
116
  context 'with FCPL Modified MPL' do
111
117
  let(:fixture) { 'fcpl-modified-mpl' }
112
118
 
@@ -152,6 +158,15 @@ RSpec.describe 'integration test' do
152
158
  end
153
159
  end
154
160
 
161
+ context 'A BSD license with CRLF line-endings' do
162
+ let(:license) { Licensee::License.find('bsd-3-clause') }
163
+ let(:fixture) { 'crlf-bsd' }
164
+
165
+ it 'matches' do
166
+ expect(subject.license).to eql(license)
167
+ end
168
+ end
169
+
155
170
  context 'BSD + PATENTS' do
156
171
  let(:license) { Licensee::License.find('other') }
157
172
  let(:fixture) { 'bsd-plus-patents' }
@@ -188,6 +203,15 @@ RSpec.describe 'integration test' do
188
203
  end
189
204
  end
190
205
 
206
+ context 'EUPL as published on choosealicense.com 2017-2019' do
207
+ let(:license) { Licensee::License.find('eupl-1.2') }
208
+ let(:fixture) { 'eupl-cal2017' }
209
+
210
+ it 'returns eupl-1.2' do
211
+ expect(subject.license).to eql(license)
212
+ end
213
+ end
214
+
191
215
  context 'Unlicense without optional line' do
192
216
  let(:license) { Licensee::License.find('unlicense') }
193
217
  let(:fixture) { 'unlicense-noinfo' }
@@ -235,6 +259,15 @@ RSpec.describe 'integration test' do
235
259
  end
236
260
  end
237
261
 
262
+ context 'Artistic with Markdown formatting' do
263
+ let(:license) { Licensee::License.find('artistic-2.0') }
264
+ let(:fixture) { 'markdown-artistic' }
265
+
266
+ it 'matches to Artistic' do
267
+ expect(subject.license).to eql(license)
268
+ end
269
+ end
270
+
238
271
  context 'BSD-3-Clause numbered and bulleted' do
239
272
  let(:license) { Licensee::License.find('bsd-3-clause') }
240
273
  let(:fixture) { 'bsd-3-lists' }
@@ -253,6 +286,15 @@ RSpec.describe 'integration test' do
253
286
  end
254
287
  end
255
288
 
289
+ context 'BSD-3-Clause author/owner variant' do
290
+ let(:license) { Licensee::License.find('bsd-3-clause') }
291
+ let(:fixture) { 'bsd-3-authorowner' }
292
+
293
+ it 'determines the project is BSD-3-Clause' do
294
+ expect(subject.license).to eql(license)
295
+ end
296
+ end
297
+
256
298
  context 'HTML license file' do
257
299
  let(:license) { Licensee::License.find('epl-1.0') }
258
300
  let(:fixture) { 'html' }
@@ -261,6 +303,42 @@ RSpec.describe 'integration test' do
261
303
  expect(subject.license).to eql(license)
262
304
  end
263
305
  end
306
+
307
+ context 'Vim license file' do
308
+ let(:license) { Licensee::License.find('vim') }
309
+ let(:fixture) { 'vim' }
310
+
311
+ it 'matches to Vim' do
312
+ expect(subject.license).to eql(license)
313
+ end
314
+ end
315
+
316
+ context 'CC-BY-SA no CC licensor statement license file' do
317
+ let(:license) { Licensee::License.find('cc-by-sa-4.0') }
318
+ let(:fixture) { 'cc-by-sa-nocclicensor' }
319
+
320
+ it 'matches to CC-BY-SA' do
321
+ expect(subject.license).to eql(license)
322
+ end
323
+ end
324
+
325
+ context 'CC-BY-SA markdown links file' do
326
+ let(:license) { Licensee::License.find('cc-by-sa-4.0') }
327
+ let(:fixture) { 'cc-by-sa-mdlinks' }
328
+
329
+ it 'matches to CC-BY-SA' do
330
+ expect(subject.license).to eql(license)
331
+ end
332
+ end
333
+
334
+ context 'MIT with byte order mark' do
335
+ let(:license) { Licensee::License.find('mit') }
336
+ let(:fixture) { 'bom' }
337
+
338
+ it 'matches to MIT' do
339
+ expect(subject.license).to eql(license)
340
+ end
341
+ end
264
342
  end
265
343
 
266
344
  context 'with the license file stubbed' do
@@ -268,17 +346,16 @@ RSpec.describe 'integration test' do
268
346
 
269
347
  before do
270
348
  File.write(license_path, content)
271
- if project_type == Licensee::Projects::GitProject
272
- git_init(project_path)
273
- end
349
+ git_init(project_path) if project_type == Licensee::Projects::GitProject
274
350
  end
275
351
 
276
352
  after { FileUtils.rm_rf(project_path) }
277
353
 
278
- [
354
+ filenames = [
279
355
  'LICENSE.md', 'LICENSE.txt', 'LICENSE.md', 'LiCeNSe.Txt',
280
356
  'LICENSE-MIT', 'MIT-LICENSE', 'licence', 'unlicense'
281
- ].each do |filename|
357
+ ]
358
+ filenames.each do |filename|
282
359
  context "with a #{filename} file" do
283
360
  let(:filename) { filename }
284
361
 
@@ -19,7 +19,7 @@ RSpec.describe 'detect command' do
19
19
  'Matched files' => 'LICENSE.md, licensee.gemspec',
20
20
  'LICENSE.md' => {
21
21
  'Content hash' => hash,
22
- 'Attribution' => 'Copyright (c) 2014-2017 Ben Balter',
22
+ 'Attribution' => 'Copyright (c) 2014-2021 Ben Balter and Licensee contributors',
23
23
  'Confidence' => '100.00%',
24
24
  'Matcher' => 'Licensee::Matchers::Exact',
25
25
  'License' => 'MIT'
@@ -70,7 +70,7 @@ RSpec.describe 'detect command' do
70
70
  end
71
71
 
72
72
  it 'returns the expected output' do
73
- msg = '`licensee detect --json` output did not match expectations. '.dup
73
+ msg = +'`licensee detect --json` output did not match expectations. '
74
74
  msg << 'Run `script/dump-detect-json-fixture` and verify the output.'
75
75
  expect(JSON.parse(stdout)).to eql(expected), msg
76
76
  end
@@ -12,10 +12,14 @@ class ContentHelperTestHelper
12
12
  def filename
13
13
  @data[:filename]
14
14
  end
15
+
16
+ def spdx_id
17
+ @data[:spdx_id]
18
+ end
15
19
  end
16
20
 
17
21
  RSpec.describe Licensee::ContentHelper do
18
- subject { ContentHelperTestHelper.new(content, filename: filename) }
22
+ subject { ContentHelperTestHelper.new(content, filename: filename, spdx_id: spdx_id) }
19
23
 
20
24
  let(:content) do
21
25
  <<-LICENSE.gsub(/^\s*/, '')
@@ -37,6 +41,7 @@ RSpec.describe Licensee::ContentHelper do
37
41
  LICENSE
38
42
  end
39
43
  let(:filename) { 'license.md' }
44
+ let(:spdx_id) { 'MIT' }
40
45
 
41
46
  let(:mit) { Licensee::License.find('mit') }
42
47
  let(:normalized_content) { subject.content_normalized }
@@ -44,7 +49,7 @@ RSpec.describe Licensee::ContentHelper do
44
49
  it 'creates the wordset' do
45
50
  wordset = Set.new(
46
51
  %w[
47
- the made up license this provided as is please respect
52
+ the made up license this provided as is' please respect
48
53
  contributors' wishes when implementing license's software
49
54
  ]
50
55
  )
@@ -55,26 +60,22 @@ RSpec.describe Licensee::ContentHelper do
55
60
  expect(subject.length).to be(135)
56
61
  end
57
62
 
58
- context 'a very long license' do
59
- let(:content) { 'license' * 1000 }
60
-
61
- it 'returns the max delta' do
62
- expect(subject.max_delta).to be(140)
63
- end
64
- end
65
-
66
63
  it 'knows the length delta' do
67
64
  expect(subject.length_delta(mit)).to be(885)
68
65
  expect(subject.length_delta(subject)).to be(0)
69
66
  end
70
67
 
71
68
  it 'knows the similarity' do
72
- expect(subject.similarity(mit)).to be_within(1).of(11)
73
- expect(subject.similarity(subject)).to be(100.0)
69
+ expect(mit.similarity(subject)).to be_within(1).of(4)
70
+ expect(mit.similarity(mit)).to be(100.0)
71
+ end
72
+
73
+ it 'calculates simple delta for similarity' do
74
+ expect(subject.similarity(mit)).to be_within(1).of(3)
74
75
  end
75
76
 
76
77
  it 'calculates the hash' do
77
- content_hash = '916b978940ecf8070c96bd3aca9321768e7f4901'
78
+ content_hash = '9b4bed43726cf39e17b11c2942f37be232f5709a'
78
79
  expect(subject.content_hash).to eql(content_hash)
79
80
  end
80
81
 
@@ -101,7 +102,10 @@ RSpec.describe Licensee::ContentHelper do
101
102
  borders: '* Foo *',
102
103
  title: "The MIT License\nfoo",
103
104
  copyright: "The MIT License\nCopyright 2018 Ben Balter\nFoo",
105
+ copyright_bullet: "The MIT License\n* Copyright 2018 Ben Balter\nFoo",
106
+ copyright_italic: "The MIT License\n_Copyright 2018 Ben Balter_\nFoo",
104
107
  end_of_terms: "Foo\nend of terms and conditions\nbar",
108
+ end_of_terms_hashes: "Foo\n# end of terms and conditions ####\nbar",
105
109
  block_markup: '> Foo',
106
110
  link_markup: '[Foo](http://exmaple.com)',
107
111
  comment_markup: "/*\n* The MIT License\n* Foo\n*/",
@@ -174,7 +178,7 @@ RSpec.describe Licensee::ContentHelper do
174
178
  end
175
179
 
176
180
  it 'normalizes quotes' do
177
- expect(normalized_content).not_to match("'as is'")
181
+ expect(normalized_content).not_to match('"as is"')
178
182
  end
179
183
 
180
184
  it 'preserves possessives' do
@@ -182,18 +186,14 @@ RSpec.describe Licensee::ContentHelper do
182
186
  expect(normalized_content).to match("license's")
183
187
  end
184
188
 
185
- it 'preserves double quotes' do
186
- expect(normalized_content).to match('"software"')
187
- end
188
-
189
189
  it 'strips the title' do
190
190
  expect(normalized_content).not_to match('MIT')
191
191
  end
192
192
 
193
193
  it 'normalize the content' do
194
- expected = 'the made up license. this license provided "as is". '.dup
194
+ expected = +"the made up license. this license provided 'as is'. "
195
195
  expected << "please respect the contributors' wishes when implementing "
196
- expected << "the license's \"software\"."
196
+ expected << "the license's 'software'."
197
197
  expect(normalized_content).to eql(expected)
198
198
  end
199
199
  end
@@ -235,7 +235,7 @@ RSpec.describe Licensee::ContentHelper do
235
235
  let(:content) { "`a` 'b' \"c\" ‘d’ “e”" }
236
236
 
237
237
  it 'normalizes quotes' do
238
- expect(subject.content_normalized).to eql('"a" "b" "c" "d" "e"')
238
+ expect(subject.content_normalized).to eql("'a' 'b' 'c' 'd' 'e'")
239
239
  end
240
240
  end
241
241
 
@@ -1,35 +1,35 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- RSpec.describe Licensee::HashHelper do
4
- class HashHelperSpecFixture
5
- include Licensee::HashHelper
6
- HASH_METHODS = %w[string array rule rules nil_value].freeze
3
+ class HashHelperSpecFixture
4
+ include Licensee::HashHelper
5
+ HASH_METHODS = %w[string array rule rules nil_value].freeze
7
6
 
8
- def string
9
- 'foo'
10
- end
7
+ def string
8
+ 'foo'
9
+ end
11
10
 
12
- def array
13
- [1, 2, 3]
14
- end
11
+ def array
12
+ [1, 2, 3]
13
+ end
15
14
 
16
- def rule
17
- rules.first
18
- end
15
+ def rule
16
+ rules.first
17
+ end
19
18
 
20
- def rules
21
- Licensee::Rule.all
22
- end
19
+ def rules
20
+ Licensee::Rule.all
21
+ end
23
22
 
24
- def baz
25
- 'baz'
26
- end
23
+ def baz
24
+ 'baz'
25
+ end
27
26
 
28
- def nil_value
29
- nil
30
- end
27
+ def nil_value
28
+ nil
31
29
  end
30
+ end
32
31
 
32
+ RSpec.describe Licensee::HashHelper do
33
33
  let(:fixture) { HashHelperSpecFixture.new }
34
34
  let(:hash) { fixture.to_h }
35
35
  let(:expected) do
@@ -115,17 +115,11 @@ RSpec.describe Licensee::LicenseMeta do
115
115
  context 'to_h' do
116
116
  let(:hash) { subject.to_h }
117
117
  let(:using) do
118
- [
119
- {
120
- 'Babel' => 'https://github.com/babel/babel/blob/master/LICENSE'
121
- },
122
- {
123
- '.NET Core' => 'https://github.com/dotnet/runtime/blob/master/LICENSE.TXT'
124
- },
125
- {
126
- 'Rails' => 'https://github.com/rails/rails/blob/master/MIT-LICENSE'
127
- }
128
- ]
118
+ {
119
+ 'Babel' => 'https://github.com/babel/babel/blob/master/LICENSE',
120
+ '.NET Core' => 'https://github.com/dotnet/runtime/blob/master/LICENSE.TXT',
121
+ 'Rails' => 'https://github.com/rails/rails/blob/master/MIT-LICENSE'
122
+ }
129
123
  end
130
124
  let(:expected) do
131
125
  {