licensee 9.14.0 → 9.14.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/lib/licensee/commands/detect.rb +1 -1
  3. data/lib/licensee/commands/diff.rb +2 -2
  4. data/lib/licensee/content_helper.rb +17 -10
  5. data/lib/licensee/license.rb +1 -1
  6. data/lib/licensee/matchers/cabal.rb +1 -1
  7. data/lib/licensee/matchers/cargo.rb +1 -1
  8. data/lib/licensee/matchers/copyright.rb +1 -1
  9. data/lib/licensee/matchers/dist_zilla.rb +1 -1
  10. data/lib/licensee/matchers/gemspec.rb +4 -4
  11. data/lib/licensee/matchers/npm_bower.rb +5 -2
  12. data/lib/licensee/matchers/nuget.rb +6 -6
  13. data/lib/licensee/matchers/spdx.rb +1 -1
  14. data/lib/licensee/project_files/license_file.rb +3 -3
  15. data/lib/licensee/project_files/project_file.rb +1 -0
  16. data/lib/licensee/projects/github_project.rb +1 -1
  17. data/lib/licensee/version.rb +1 -1
  18. data/licensee.gemspec +1 -1
  19. data/spec/fixtures/bom/LICENSE.txt +21 -0
  20. data/spec/fixtures/crlf-bsd/LICENSE.md +27 -0
  21. data/spec/fixtures/detect.json +12 -18
  22. data/spec/fixtures/fixtures.yml +20 -4
  23. data/spec/fixtures/license-hashes.json +1 -1
  24. data/spec/fixtures/markdown-artistic/LICENSE.md +192 -0
  25. data/spec/fixtures/vim/LICENSE +78 -0
  26. data/spec/integration_spec.rb +39 -2
  27. data/spec/licensee/content_helper_spec.rb +2 -0
  28. data/spec/licensee/hash_helper_spec.rb +22 -22
  29. data/spec/licensee/license_meta_spec.rb +5 -11
  30. data/spec/licensee/license_spec.rb +9 -5
  31. data/spec/licensee/matchers/dice_matcher_spec.rb +1 -1
  32. data/spec/licensee/matchers/matcher_spec.rb +6 -6
  33. data/spec/licensee/matchers/npm_bower_matcher_spec.rb +9 -0
  34. data/spec/licensee/project_files/license_file_spec.rb +27 -26
  35. data/spec/licensee/rule_spec.rb +1 -1
  36. data/vendor/choosealicense.com/_data/meta.yml +1 -1
  37. data/vendor/choosealicense.com/_data/rules.yml +13 -13
  38. data/vendor/choosealicense.com/_licenses/0bsd.txt +3 -3
  39. data/vendor/choosealicense.com/_licenses/apache-2.0.txt +3 -3
  40. data/vendor/choosealicense.com/_licenses/bsd-2-clause.txt +3 -3
  41. data/vendor/choosealicense.com/_licenses/bsd-3-clause.txt +3 -3
  42. data/vendor/choosealicense.com/_licenses/bsd-4-clause.txt +3 -3
  43. data/vendor/choosealicense.com/_licenses/bsl-1.0.txt +3 -3
  44. data/vendor/choosealicense.com/_licenses/cc-by-4.0.txt +3 -3
  45. data/vendor/choosealicense.com/_licenses/cc-by-sa-4.0.txt +3 -3
  46. data/vendor/choosealicense.com/_licenses/cc0-1.0.txt +3 -3
  47. data/vendor/choosealicense.com/_licenses/cecill-2.1.txt +3 -3
  48. data/vendor/choosealicense.com/_licenses/ecl-2.0.txt +3 -3
  49. data/vendor/choosealicense.com/_licenses/epl-1.0.txt +3 -3
  50. data/vendor/choosealicense.com/_licenses/epl-2.0.txt +3 -3
  51. data/vendor/choosealicense.com/_licenses/eupl-1.2.txt +3 -3
  52. data/vendor/choosealicense.com/_licenses/gpl-2.0.txt +3 -3
  53. data/vendor/choosealicense.com/_licenses/gpl-3.0.txt +3 -3
  54. data/vendor/choosealicense.com/_licenses/isc.txt +3 -3
  55. data/vendor/choosealicense.com/_licenses/mit.txt +3 -3
  56. data/vendor/choosealicense.com/_licenses/mpl-2.0.txt +3 -3
  57. data/vendor/choosealicense.com/_licenses/ncsa.txt +3 -3
  58. data/vendor/choosealicense.com/_licenses/odbl-1.0.txt +3 -3
  59. data/vendor/choosealicense.com/_licenses/ofl-1.1.txt +3 -3
  60. data/vendor/choosealicense.com/_licenses/osl-3.0.txt +3 -3
  61. data/vendor/choosealicense.com/_licenses/postgresql.txt +3 -3
  62. data/vendor/choosealicense.com/_licenses/unlicense.txt +3 -3
  63. data/vendor/choosealicense.com/_licenses/upl-1.0.txt +3 -3
  64. data/vendor/choosealicense.com/_licenses/vim.txt +3 -3
  65. data/vendor/choosealicense.com/_licenses/zlib.txt +3 -3
  66. metadata +18 -8
@@ -29,7 +29,7 @@
29
29
  "ms-pl": "c900293d66a241e54f7817367a8f32f7f94e12ff",
30
30
  "ms-rl": "402bf344e506a8d10175c1e516b396c060ffd823",
31
31
  "ncsa": "da965ab8e2094b0f0ac97a8502272b5400c29508",
32
- "odbl-1.0": "4f4c0884535ebe8fdf1b93d2d3505e323144831f",
32
+ "odbl-1.0": "6246137f1527f9a90b77e05bd5061bee83bb33ae",
33
33
  "ofl-1.1": "1fb0563aa1250e18a6948afde286edc95761f461",
34
34
  "osl-3.0": "ab241ef932d3ac038e8ed62c860e9eba051ae7a0",
35
35
  "postgresql": "87550a6bb3409db00d8552b2ac07d373ea56a024",
@@ -0,0 +1,192 @@
1
+ The Artistic License 2.0
2
+ ========================
3
+
4
+ _Copyright © 2000-2006, The Perl Foundation._
5
+
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ ### Preamble
10
+
11
+ This license establishes the terms under which a given free software
12
+ Package may be copied, modified, distributed, and/or redistributed.
13
+ The intent is that the Copyright Holder maintains some artistic
14
+ control over the development of that Package while still keeping the
15
+ Package available as open source and free software.
16
+
17
+ You are always permitted to make arrangements wholly outside of this
18
+ license directly with the Copyright Holder of a given Package. If the
19
+ terms of this license do not permit the full use that you propose to
20
+ make of the Package, you should contact the Copyright Holder and seek
21
+ a different licensing arrangement.
22
+
23
+ ### Definitions
24
+
25
+ “Copyright Holder” means the individual(s) or organization(s)
26
+ named in the copyright notice for the entire Package.
27
+
28
+ “Contributor” means any party that has contributed code or other
29
+ material to the Package, in accordance with the Copyright Holder's
30
+ procedures.
31
+
32
+ “You” and “your” means any person who would like to copy,
33
+ distribute, or modify the Package.
34
+
35
+ “Package” means the collection of files distributed by the
36
+ Copyright Holder, and derivatives of that collection and/or of
37
+ those files. A given Package may consist of either the Standard
38
+ Version, or a Modified Version.
39
+
40
+ “Distribute” means providing a copy of the Package or making it
41
+ accessible to anyone else, or in the case of a company or
42
+ organization, to others outside of your company or organization.
43
+
44
+ “Distributor Fee” means any fee that you charge for Distributing
45
+ this Package or providing support for this Package to another
46
+ party. It does not mean licensing fees.
47
+
48
+ “Standard Version” refers to the Package if it has not been
49
+ modified, or has been modified only in ways explicitly requested
50
+ by the Copyright Holder.
51
+
52
+ “Modified Version” means the Package, if it has been changed, and
53
+ such changes were not explicitly requested by the Copyright
54
+ Holder.
55
+
56
+ “Original License” means this Artistic License as Distributed with
57
+ the Standard Version of the Package, in its current version or as
58
+ it may be modified by The Perl Foundation in the future.
59
+
60
+ “Source” form means the source code, documentation source, and
61
+ configuration files for the Package.
62
+
63
+ “Compiled” form means the compiled bytecode, object code, binary,
64
+ or any other form resulting from mechanical transformation or
65
+ translation of the Source form.
66
+
67
+ ### Permission for Use and Modification Without Distribution
68
+
69
+ **(1)** You are permitted to use the Standard Version and create and use
70
+ Modified Versions for any purpose without restriction, provided that
71
+ you do not Distribute the Modified Version.
72
+
73
+ ### Permissions for Redistribution of the Standard Version
74
+
75
+ **(2)** You may Distribute verbatim copies of the Source form of the
76
+ Standard Version of this Package in any medium without restriction,
77
+ either gratis or for a Distributor Fee, provided that you duplicate
78
+ all of the original copyright notices and associated disclaimers. At
79
+ your discretion, such verbatim copies may or may not include a
80
+ Compiled form of the Package.
81
+
82
+ **(3)** You may apply any bug fixes, portability changes, and other
83
+ modifications made available from the Copyright Holder. The resulting
84
+ Package will still be considered the Standard Version, and as such
85
+ will be subject to the Original License.
86
+
87
+ ### Distribution of Modified Versions of the Package as Source
88
+
89
+ **(4)** You may Distribute your Modified Version as Source (either gratis
90
+ or for a Distributor Fee, and with or without a Compiled form of the
91
+ Modified Version) provided that you clearly document how it differs
92
+ from the Standard Version, including, but not limited to, documenting
93
+ any non-standard features, executables, or modules, and provided that
94
+ you do at least ONE of the following:
95
+
96
+ * **(a)** make the Modified Version available to the Copyright Holder
97
+ of the Standard Version, under the Original License, so that the
98
+ Copyright Holder may include your modifications in the Standard
99
+ Version.
100
+ * **(b)** ensure that installation of your Modified Version does not
101
+ prevent the user installing or running the Standard Version. In
102
+ addition, the Modified Version must bear a name that is different
103
+ from the name of the Standard Version.
104
+ * **(c)** allow anyone who receives a copy of the Modified Version to
105
+ make the Source form of the Modified Version available to others
106
+ under
107
+ * **(i)** the Original License or
108
+ * **(ii)** a license that permits the licensee to freely copy,
109
+ modify and redistribute the Modified Version using the same
110
+ licensing terms that apply to the copy that the licensee
111
+ received, and requires that the Source form of the Modified
112
+ Version, and of any works derived from it, be made freely
113
+ available in that license fees are prohibited but Distributor
114
+ Fees are allowed.
115
+
116
+ ### Distribution of Compiled Forms of the Standard Version
117
+ ### or Modified Versions without the Source
118
+
119
+ **(5)** You may Distribute Compiled forms of the Standard Version without
120
+ the Source, provided that you include complete instructions on how to
121
+ get the Source of the Standard Version. Such instructions must be
122
+ valid at the time of your distribution. If these instructions, at any
123
+ time while you are carrying out such distribution, become invalid, you
124
+ must provide new instructions on demand or cease further distribution.
125
+ If you provide valid instructions or cease distribution within thirty
126
+ days after you become aware that the instructions are invalid, then
127
+ you do not forfeit any of your rights under this license.
128
+
129
+ **(6)** You may Distribute a Modified Version in Compiled form without
130
+ the Source, provided that you comply with Section 4 with respect to
131
+ the Source of the Modified Version.
132
+
133
+ ### Aggregating or Linking the Package
134
+
135
+ **(7)** You may aggregate the Package (either the Standard Version or
136
+ Modified Version) with other packages and Distribute the resulting
137
+ aggregation provided that you do not charge a licensing fee for the
138
+ Package. Distributor Fees are permitted, and licensing fees for other
139
+ components in the aggregation are permitted. The terms of this license
140
+ apply to the use and Distribution of the Standard or Modified Versions
141
+ as included in the aggregation.
142
+
143
+ **(8)** You are permitted to link Modified and Standard Versions with
144
+ other works, to embed the Package in a larger work of your own, or to
145
+ build stand-alone binary or bytecode versions of applications that
146
+ include the Package, and Distribute the result without restriction,
147
+ provided the result does not expose a direct interface to the Package.
148
+
149
+ ### Items That are Not Considered Part of a Modified Version
150
+
151
+ **(9)** Works (including, but not limited to, modules and scripts) that
152
+ merely extend or make use of the Package, do not, by themselves, cause
153
+ the Package to be a Modified Version. In addition, such works are not
154
+ considered parts of the Package itself, and are not subject to the
155
+ terms of this license.
156
+
157
+ ### General Provisions
158
+
159
+ **(10)** Any use, modification, and distribution of the Standard or
160
+ Modified Versions is governed by this Artistic License. By using,
161
+ modifying or distributing the Package, you accept this license. Do not
162
+ use, modify, or distribute the Package, if you do not accept this
163
+ license.
164
+
165
+ **(11)** If your Modified Version has been derived from a Modified
166
+ Version made by someone other than you, you are nevertheless required
167
+ to ensure that your Modified Version complies with the requirements of
168
+ this license.
169
+
170
+ **(12)** This license does not grant you the right to use any trademark,
171
+ service mark, tradename, or logo of the Copyright Holder.
172
+
173
+ **(13)** This license includes the non-exclusive, worldwide,
174
+ free-of-charge patent license to make, have made, use, offer to sell,
175
+ sell, import and otherwise transfer the Package with respect to any
176
+ patent claims licensable by the Copyright Holder that are necessarily
177
+ infringed by the Package. If you institute patent litigation
178
+ (including a cross-claim or counterclaim) against any party alleging
179
+ that the Package constitutes direct or contributory patent
180
+ infringement, then this Artistic License to you shall terminate on the
181
+ date that such litigation is filed.
182
+
183
+ **(14)** **Disclaimer of Warranty:**
184
+
185
+ THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
186
+ IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
187
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
188
+ NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
189
+ LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
190
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
191
+ DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
192
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -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.
@@ -152,6 +152,15 @@ RSpec.describe 'integration test' do
152
152
  end
153
153
  end
154
154
 
155
+ context 'A BSD license with CRLF line-endings' do
156
+ let(:license) { Licensee::License.find('bsd-3-clause') }
157
+ let(:fixture) { 'crlf-bsd' }
158
+
159
+ it 'matches' do
160
+ expect(subject.license).to eql(license)
161
+ end
162
+ end
163
+
155
164
  context 'BSD + PATENTS' do
156
165
  let(:license) { Licensee::License.find('other') }
157
166
  let(:fixture) { 'bsd-plus-patents' }
@@ -235,6 +244,15 @@ RSpec.describe 'integration test' do
235
244
  end
236
245
  end
237
246
 
247
+ context 'Artistic with Markdown formatting' do
248
+ let(:license) { Licensee::License.find('artistic-2.0') }
249
+ let(:fixture) { 'markdown-artistic' }
250
+
251
+ it 'matches to Artistic' do
252
+ expect(subject.license).to eql(license)
253
+ end
254
+ end
255
+
238
256
  context 'BSD-3-Clause numbered and bulleted' do
239
257
  let(:license) { Licensee::License.find('bsd-3-clause') }
240
258
  let(:fixture) { 'bsd-3-lists' }
@@ -261,6 +279,24 @@ RSpec.describe 'integration test' do
261
279
  expect(subject.license).to eql(license)
262
280
  end
263
281
  end
282
+
283
+ context 'Vim license file' do
284
+ let(:license) { Licensee::License.find('vim') }
285
+ let(:fixture) { 'vim' }
286
+
287
+ it 'matches to Vim' do
288
+ expect(subject.license).to eql(license)
289
+ end
290
+ end
291
+
292
+ context 'MIT with byte order mark' do
293
+ let(:license) { Licensee::License.find('mit') }
294
+ let(:fixture) { 'bom' }
295
+
296
+ it 'matches to MIT' do
297
+ expect(subject.license).to eql(license)
298
+ end
299
+ end
264
300
  end
265
301
 
266
302
  context 'with the license file stubbed' do
@@ -275,10 +311,11 @@ RSpec.describe 'integration test' do
275
311
 
276
312
  after { FileUtils.rm_rf(project_path) }
277
313
 
278
- [
314
+ filenames = [
279
315
  'LICENSE.md', 'LICENSE.txt', 'LICENSE.md', 'LiCeNSe.Txt',
280
316
  'LICENSE-MIT', 'MIT-LICENSE', 'licence', 'unlicense'
281
- ].each do |filename|
317
+ ]
318
+ filenames.each do |filename|
282
319
  context "with a #{filename} file" do
283
320
  let(:filename) { filename }
284
321
 
@@ -93,6 +93,8 @@ RSpec.describe Licensee::ContentHelper do
93
93
  borders: '* Foo *',
94
94
  title: "The MIT License\nfoo",
95
95
  copyright: "The MIT License\nCopyright 2018 Ben Balter\nFoo",
96
+ copyright_bullet: "The MIT License\n* Copyright 2018 Ben Balter\nFoo",
97
+ copyright_italic: "The MIT License\n_Copyright 2018 Ben Balter_\nFoo",
96
98
  end_of_terms: "Foo\nend of terms and conditions\nbar",
97
99
  end_of_terms_hashes: "Foo\n# end of terms and conditions ####\nbar",
98
100
  block_markup: '> Foo',
@@ -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
  {
@@ -345,7 +345,7 @@ RSpec.describe Licensee::License do
345
345
  context 'muscache' do
346
346
  let(:license) do
347
347
  license = described_class.new 'MIT'
348
- content = license.content + '[foo] [bar]'
348
+ content = "#{license.content}[foo] [bar]"
349
349
  license.instance_variable_set(:@content, content)
350
350
  license
351
351
  end
@@ -365,9 +365,10 @@ RSpec.describe Licensee::License do
365
365
  end
366
366
 
367
367
  context 'License.title_regex' do
368
+ namey = %i[title nickname key]
368
369
  described_class.all(hidden: true, pseudo: false).each do |license|
369
370
  context "the #{license.title} license" do
370
- %i[title nickname key].each do |variation|
371
+ namey.each do |variation|
371
372
  next if license.send(variation).nil?
372
373
 
373
374
  context "the license #{variation}" do
@@ -475,21 +476,24 @@ RSpec.describe Licensee::License do
475
476
  end
476
477
 
477
478
  context 'source regex' do
479
+ schemes = %w[http https]
480
+ prefixes = ['www.', '']
481
+ suffixes = ['.html', '.htm', '.txt', '']
478
482
  described_class.all(hidden: true, pseudo: false).each do |license|
479
483
  context "the #{license.title} license" do
480
484
  let(:source) { URI.parse(license.source) }
481
485
 
482
- %w[http https].each do |scheme|
486
+ schemes.each do |scheme|
483
487
  context "with a #{scheme}:// scheme" do
484
488
  before { source.scheme = scheme }
485
489
 
486
- ['www.', ''].each do |prefix|
490
+ prefixes.each do |prefix|
487
491
  context "with '#{prefix}' before the host" do
488
492
  before do
489
493
  source.host = "#{prefix}#{source.host.sub(/\Awww\./, '')}"
490
494
  end
491
495
 
492
- ['.html', '.htm', '.txt', ''].each do |suffix|
496
+ suffixes.each do |suffix|
493
497
  context "with '#{suffix}' after the path" do
494
498
  before do
495
499
  next if license.key == 'wtfpl'