license_finder 1.1.1-java → 1.2-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -2
  3. data/CHANGELOG.rdoc +10 -0
  4. data/Gemfile +1 -1
  5. data/README.md +363 -0
  6. data/Rakefile +30 -1
  7. data/TODO.md +28 -0
  8. data/bin/license_finder_pip.py +18 -0
  9. data/db/migrate/201410031451_rename_dependency_license_name.rb +6 -0
  10. data/features/multiple_licenses.feature +9 -0
  11. data/features/step_definitions/cli_steps.rb +9 -9
  12. data/features/step_definitions/cocoapod_steps.rb +1 -1
  13. data/features/step_definitions/configure_bundler_groups_steps.rb +3 -3
  14. data/features/step_definitions/configure_whitelist_steps.rb +4 -4
  15. data/features/step_definitions/gradle_steps.rb +1 -1
  16. data/features/step_definitions/manually_added_steps.rb +3 -3
  17. data/features/step_definitions/manually_approved_steps.rb +5 -5
  18. data/features/step_definitions/manually_assigned_license_steps.rb +4 -4
  19. data/features/step_definitions/maven_steps.rb +1 -1
  20. data/features/step_definitions/multiple_licenses_steps.rb +14 -0
  21. data/features/step_definitions/node_steps.rb +1 -1
  22. data/features/step_definitions/python_steps.rb +1 -1
  23. data/features/step_definitions/report_csv_steps.rb +3 -3
  24. data/features/step_definitions/report_html_steps.rb +5 -5
  25. data/features/step_definitions/shared_steps.rb +23 -6
  26. data/lib/license_finder.rb +3 -0
  27. data/lib/license_finder/cli.rb +13 -34
  28. data/lib/license_finder/configuration.rb +8 -4
  29. data/lib/license_finder/dependency_manager.rb +25 -15
  30. data/lib/license_finder/license.rb +8 -0
  31. data/lib/license_finder/logger.rb +59 -0
  32. data/lib/license_finder/package.rb +37 -30
  33. data/lib/license_finder/package_manager.rb +20 -0
  34. data/lib/license_finder/package_managers/bower.rb +4 -9
  35. data/lib/license_finder/package_managers/bower_package.rb +2 -1
  36. data/lib/license_finder/package_managers/bundler.rb +26 -41
  37. data/lib/license_finder/package_managers/bundler_package.rb +6 -3
  38. data/lib/license_finder/package_managers/cocoa_pods.rb +18 -10
  39. data/lib/license_finder/package_managers/cocoa_pods_package.rb +4 -3
  40. data/lib/license_finder/package_managers/gradle.rb +7 -11
  41. data/lib/license_finder/package_managers/gradle_package.rb +2 -7
  42. data/lib/license_finder/package_managers/maven.rb +5 -9
  43. data/lib/license_finder/package_managers/maven_package.rb +4 -8
  44. data/lib/license_finder/package_managers/npm.rb +6 -10
  45. data/lib/license_finder/package_managers/npm_package.rb +2 -1
  46. data/lib/license_finder/package_managers/pip.rb +11 -24
  47. data/lib/license_finder/package_managers/pip_package.rb +2 -1
  48. data/lib/license_finder/package_saver.rb +2 -2
  49. data/lib/license_finder/platform.rb +4 -0
  50. data/lib/license_finder/possible_license_file.rb +4 -0
  51. data/lib/license_finder/possible_license_files.rb +2 -1
  52. data/lib/license_finder/reports/detailed_text_report.rb +1 -1
  53. data/lib/license_finder/reports/formatted_report.rb +1 -1
  54. data/lib/license_finder/tables/dependency.rb +22 -12
  55. data/lib/license_finder/yml_to_sql.rb +1 -1
  56. data/lib/templates/html_report.erb +4 -4
  57. data/lib/templates/markdown_report.erb +4 -4
  58. data/lib/templates/text_report.erb +1 -1
  59. data/license_finder.gemspec +28 -12
  60. data/spec/lib/license_finder/cli_spec.rb +193 -185
  61. data/spec/lib/license_finder/configuration_spec.rb +46 -47
  62. data/spec/lib/license_finder/dependency_manager_spec.rb +48 -44
  63. data/spec/lib/license_finder/license/definitions_spec.rb +26 -26
  64. data/spec/lib/license_finder/license_spec.rb +25 -25
  65. data/spec/lib/license_finder/package_managers/bower_package_spec.rb +33 -17
  66. data/spec/lib/license_finder/package_managers/bower_spec.rb +35 -35
  67. data/spec/lib/license_finder/package_managers/bundler_package_spec.rb +20 -15
  68. data/spec/lib/license_finder/package_managers/bundler_spec.rb +12 -19
  69. data/spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb +8 -5
  70. data/spec/lib/license_finder/package_managers/cocoa_pods_spec.rb +20 -22
  71. data/spec/lib/license_finder/package_managers/gradle_package_spec.rb +8 -5
  72. data/spec/lib/license_finder/package_managers/gradle_spec.rb +20 -20
  73. data/spec/lib/license_finder/package_managers/maven_package_spec.rb +8 -5
  74. data/spec/lib/license_finder/package_managers/maven_spec.rb +18 -18
  75. data/spec/lib/license_finder/package_managers/npm_package_spec.rb +36 -17
  76. data/spec/lib/license_finder/package_managers/npm_spec.rb +17 -17
  77. data/spec/lib/license_finder/package_managers/pip_package_spec.rb +16 -10
  78. data/spec/lib/license_finder/package_managers/pip_spec.rb +21 -18
  79. data/spec/lib/license_finder/package_saver_spec.rb +15 -25
  80. data/spec/lib/license_finder/possible_license_file_spec.rb +5 -4
  81. data/spec/lib/license_finder/possible_license_files_spec.rb +11 -5
  82. data/spec/lib/license_finder/reports/detailed_text_report_spec.rb +3 -3
  83. data/spec/lib/license_finder/reports/html_report_spec.rb +23 -23
  84. data/spec/lib/license_finder/reports/markdown_report_spec.rb +12 -12
  85. data/spec/lib/license_finder/reports/reporter_spec.rb +11 -11
  86. data/spec/lib/license_finder/reports/text_report_spec.rb +3 -3
  87. data/spec/lib/license_finder/tables/dependency_spec.rb +59 -41
  88. data/spec/lib/license_finder/yml_to_sql_spec.rb +21 -21
  89. data/spec/lib/license_finder_spec.rb +1 -1
  90. data/spec/spec_helper.rb +0 -13
  91. data/spec/support/shared_examples_for_package.rb +46 -0
  92. data/spec/support/shared_examples_for_package_manager.rb +15 -0
  93. metadata +19 -100
  94. data/readme.md +0 -259
@@ -7,7 +7,7 @@ module LicenseFinder
7
7
  Dependency.new(
8
8
  'name' => 'gem_a',
9
9
  'version' => '1.0',
10
- 'license' => License.find_by_name('other')
10
+ 'licenses' => [License.find_by_name('other')].to_set
11
11
  )
12
12
  end
13
13
 
@@ -15,7 +15,7 @@ module LicenseFinder
15
15
  dependency = Dependency.create(
16
16
  'name' => 'gem_b',
17
17
  'version' => '2.3',
18
- 'license' => License.find_by_name('BSD')
18
+ 'licenses' => [License.find_by_name('BSD')].to_set
19
19
  )
20
20
  dependency.approve!
21
21
  dependency
@@ -25,28 +25,28 @@ module LicenseFinder
25
25
 
26
26
  it 'should have the correct header' do
27
27
  LicenseFinder.config.project_name = "new_project_name"
28
- should match "# new_project_name"
28
+ is_expected.to match "# new_project_name"
29
29
  end
30
30
 
31
31
  it 'should list the total, and unapproved counts' do
32
- should match "2 total"
33
- should match /1 \*unapproved\*/
32
+ is_expected.to match "2 total"
33
+ is_expected.to match /1 \*unapproved\*/
34
34
  end
35
35
 
36
36
  it "should list the unapproved dependency" do
37
- should match "href='#gem_a'"
37
+ is_expected.to match "href='#gem_a'"
38
38
  end
39
39
 
40
40
  it "should display a summary" do
41
- should match "## Summary"
42
- should match /\s+\* 1 other/
43
- should match /\s+\* 1 BSD/
41
+ is_expected.to match "## Summary"
42
+ is_expected.to match /\s+\* 1 other/
43
+ is_expected.to match /\s+\* 1 BSD/
44
44
  end
45
45
 
46
46
  it "should list both gems" do
47
- should match "## Items"
48
- should match "### gem_a v1.0"
49
- should match "### gem_b v2.3"
47
+ is_expected.to match "## Items"
48
+ is_expected.to match "### gem_a v1.0"
49
+ is_expected.to match "### gem_b v2.3"
50
50
  end
51
51
  end
52
52
  end
@@ -6,26 +6,26 @@ module LicenseFinder
6
6
  subject { Reporter.write_reports }
7
7
 
8
8
  before do
9
- Dependency.stub(:acknowledged) { [double(:dep)] }
9
+ allow(Dependency).to receive(:acknowledged) { [double(:dep)] }
10
10
 
11
- MarkdownReport.stub(:of) { 'markdown report' }
12
- DetailedTextReport.stub(:of) { 'detailed csv report' }
13
- TextReport.stub(:of) { 'csv report' }
14
- HtmlReport.stub(:of) { 'html report' }
11
+ allow(MarkdownReport).to receive(:of) { 'markdown report' }
12
+ allow(DetailedTextReport).to receive(:of) { 'detailed csv report' }
13
+ allow(TextReport).to receive(:of) { 'csv report' }
14
+ allow(HtmlReport).to receive(:of) { 'html report' }
15
15
  end
16
16
 
17
17
  it "writes an html file" do
18
18
  subject
19
- LicenseFinder.config.artifacts.text_file.read.should == "csv report\n"
20
- LicenseFinder.config.artifacts.detailed_text_file.read.should == "detailed csv report\n"
21
- LicenseFinder.config.artifacts.markdown_file.read.should == "markdown report\n"
22
- LicenseFinder.config.artifacts.html_file.read.should == "html report\n"
19
+ expect(LicenseFinder.config.artifacts.text_file.read).to eq("csv report\n")
20
+ expect(LicenseFinder.config.artifacts.detailed_text_file.read).to eq("detailed csv report\n")
21
+ expect(LicenseFinder.config.artifacts.markdown_file.read).to eq("markdown report\n")
22
+ expect(LicenseFinder.config.artifacts.html_file.read).to eq("html report\n")
23
23
  end
24
24
 
25
25
  it "deletes old dependencies.txt file" do
26
26
  fake_file = double(:fake_file, :exist? => true)
27
- LicenseFinder.config.artifacts.stub(:legacy_text_file) { fake_file }
28
- fake_file.should_receive(:delete)
27
+ allow(LicenseFinder.config.artifacts).to receive(:legacy_text_file) { fake_file }
28
+ expect(fake_file).to receive(:delete)
29
29
  subject
30
30
  end
31
31
  end
@@ -7,7 +7,7 @@ module LicenseFinder
7
7
  Dependency.new(
8
8
  'name' => 'gem_a',
9
9
  'version' => '1.0',
10
- 'license' => License.find_by_name('MIT')
10
+ 'licenses' => [License.find_by_name('MIT')].to_set
11
11
  )
12
12
  end
13
13
 
@@ -15,14 +15,14 @@ module LicenseFinder
15
15
  Dependency.new(
16
16
  'name' => 'gem_b',
17
17
  'version' => '1.0',
18
- 'license' => License.find_by_name('MIT')
18
+ 'licenses' => [License.find_by_name('MIT')].to_set
19
19
  )
20
20
  end
21
21
 
22
22
  subject { TextReport.new([dep2, dep1]).to_s }
23
23
 
24
24
  it 'should generate a text report with the name, version and license of each dependency, sorted by name' do
25
- should == "gem_a, 1.0, MIT\ngem_b, 1.0, MIT"
25
+ is_expected.to eq("gem_a, 1.0, MIT\ngem_b, 1.0, MIT")
26
26
  end
27
27
  end
28
28
  end
@@ -4,7 +4,7 @@ module LicenseFinder
4
4
  describe Dependency do
5
5
  describe '.unapproved' do
6
6
  before do
7
- License.find_by_name('MIT').stub(:whitelisted? => true)
7
+ allow(License.find_by_name('MIT')).to receive_messages(:whitelisted? => true)
8
8
  allow(LicenseFinder.config).to receive(:ignore_dependencies) { ['this ignored dependency', 'that ignored dependency'] }
9
9
  end
10
10
 
@@ -15,28 +15,28 @@ module LicenseFinder
15
15
  that_ignored = Dependency.create(name: "that ignored dependency", version: '0.0.1')
16
16
  approved.approve!
17
17
  whitelisted = Dependency.create(name: "approved dependency", version: '0.0.1')
18
- whitelisted.license = License.find_by_name('MIT')
18
+ whitelisted.licenses = [License.find_by_name('MIT')].to_set
19
19
  whitelisted.save
20
20
 
21
21
  unapproved = Dependency.unapproved
22
- unapproved.count.should == 1
23
- unapproved.should_not be_any(&:approved?)
22
+ expect(unapproved.count).to eq(1)
23
+ expect(unapproved).not_to be_any(&:approved?)
24
24
  end
25
25
  end
26
26
 
27
27
  describe ".named" do
28
28
  it "creates a new dependency" do
29
29
  dep = described_class.named("never_seen")
30
- dep.name.should == "never_seen"
31
- dep.should_not be_new
30
+ expect(dep.name).to eq("never_seen")
31
+ expect(dep).not_to be_new
32
32
  end
33
33
 
34
34
  it "returns an existing dependency" do
35
35
  described_class.named("referenced_again")
36
36
  dep = described_class.named("referenced_again")
37
- dep.name.should == "referenced_again"
38
- dep.should_not be_new
39
- Dependency.count(name: "referenced_again").should == 1
37
+ expect(dep.name).to eq("referenced_again")
38
+ expect(dep).not_to be_new
39
+ expect(Dependency.count(name: "referenced_again")).to eq(1)
40
40
  end
41
41
  end
42
42
 
@@ -54,15 +54,15 @@ module LicenseFinder
54
54
  it "should update the database to show the dependency is approved" do
55
55
  dependency = Dependency.named("foo")
56
56
  dependency.approve!
57
- dependency.reload.should be_approved
57
+ expect(dependency.reload).to be_approved
58
58
  end
59
59
 
60
60
  it "should record the approver and notes" do
61
61
  dependency = Dependency.named("foo")
62
62
  dependency.approve!("Julian", "We really need this")
63
63
  approval = dependency.reload.manual_approval
64
- approval.approver.should eq "Julian"
65
- approval.notes.should eq "We really need this"
64
+ expect(approval.approver).to eq "Julian"
65
+ expect(approval.notes).to eq "We really need this"
66
66
  end
67
67
  end
68
68
 
@@ -71,18 +71,25 @@ module LicenseFinder
71
71
  let(:approved_manually) { Dependency.create(name: 'some gem').approve!.reload }
72
72
 
73
73
  it "is true if its license is whitelisted" do
74
- not_approved_manually.stub_chain(:license, whitelisted?: true)
75
- not_approved_manually.should be_approved
74
+ fake_license = double(:license, whitelisted?: true)
75
+ allow(not_approved_manually).to receive(:licenses).and_return [fake_license].to_set
76
+ expect(not_approved_manually).to be_approved
77
+ end
78
+
79
+ it "is true if one of its licenses is whitelisted" do
80
+ fake_licenses = [double(:license, whitelisted?: false), double(:license, whitelisted?: true)].to_set
81
+ allow(not_approved_manually).to receive(:licenses).and_return fake_licenses
82
+ expect(not_approved_manually).to be_approved
76
83
  end
77
84
 
78
85
  it "is true if it has been approved" do
79
- approved_manually.stub_chain(:license, whitelisted?: false)
80
- approved_manually.should be_approved
86
+ allow(approved_manually).to receive_message_chain(:license, whitelisted?: false)
87
+ expect(approved_manually).to be_approved
81
88
  end
82
89
 
83
90
  it "is false otherwise" do
84
- not_approved_manually.stub_chain(:license, whitelisted?: false)
85
- not_approved_manually.should_not be_approved
91
+ allow(not_approved_manually).to receive_message_chain(:license, whitelisted?: false)
92
+ expect(not_approved_manually).not_to be_approved
86
93
  end
87
94
  end
88
95
 
@@ -90,14 +97,14 @@ module LicenseFinder
90
97
  let(:dependency) { Dependency.create(name: 'foogem') }
91
98
 
92
99
  it "sets manual license to true" do
93
- dependency.should_not be_license_assigned_manually
100
+ expect(dependency).not_to be_license_assigned_manually
94
101
  dependency.set_license_manually! License.find_by_name("Updated")
95
- dependency.should be_license_assigned_manually
102
+ expect(dependency).to be_license_assigned_manually
96
103
  end
97
104
 
98
105
  it "modifies the license" do
99
106
  dependency.set_license_manually! License.find_by_name("Updated")
100
- dependency.reload.license.name.should == 'Updated'
107
+ expect(dependency.reload.licenses.first.name).to eq('Updated')
101
108
  end
102
109
  end
103
110
 
@@ -106,14 +113,14 @@ module LicenseFinder
106
113
 
107
114
  it "saves the bundler groups" do
108
115
  dependency.bundler_group_names = %w[1 2 3]
109
- dependency.bundler_groups.map(&:name).should =~ %w[1 2 3]
116
+ expect(dependency.bundler_groups.map(&:name)).to match_array(%w[1 2 3])
110
117
  end
111
118
 
112
119
  it "removed outdated groups and adds new groups" do
113
120
  dependency.add_bundler_group BundlerGroup.named('old')
114
121
  dependency.add_bundler_group BundlerGroup.named('maintained')
115
122
  dependency.bundler_group_names = %w[new maintained]
116
- dependency.bundler_groups.map(&:name).should =~ %w[new maintained]
123
+ expect(dependency.bundler_groups.map(&:name)).to match_array(%w[new maintained])
117
124
  end
118
125
  end
119
126
 
@@ -122,55 +129,66 @@ module LicenseFinder
122
129
 
123
130
  it "saves the children" do
124
131
  dependency.children_names = %w[1 2 3]
125
- dependency.children.map(&:name).should =~ %w[1 2 3]
132
+ expect(dependency.children.map(&:name)).to match_array(%w[1 2 3])
126
133
  end
127
134
 
128
135
  it "removes outdated children and adds new children" do
129
136
  dependency.add_child Dependency.named('old')
130
137
  dependency.add_child Dependency.named('maintained')
131
138
  dependency.children_names = %w[new maintained]
132
- dependency.children.map(&:name).should =~ %w[new maintained]
139
+ expect(dependency.children.map(&:name)).to match_array(%w[new maintained])
133
140
  end
134
141
  end
135
142
 
136
- describe "#apply_better_license" do
143
+ describe "#set_licenses" do
137
144
  let(:dependency) { Dependency.named('some gem') }
138
145
 
139
146
  it "keeps a manually assigned license" do
140
147
  dependency.set_license_manually! License.find_by_name("manual")
141
- dependency.apply_better_license License.find_by_name("new")
142
- dependency.license.name.should == "manual"
148
+ dependency.set_licenses [License.find_by_name("new")].to_set
149
+ expect(dependency.licenses.first.name).to eq "manual"
143
150
  end
144
151
 
145
152
  it "saves a new license" do
146
- dependency.apply_better_license License.find_by_name("new license")
147
- dependency.license.name.should == "new license"
153
+ dependency.set_licenses [License.find_by_name("new license")].to_set
154
+ expect(dependency.licenses.first.name).to eq "new license"
148
155
  end
149
156
 
150
157
  it "updates the license's name" do
151
- dependency.license = License.find_by_name("old")
158
+ dependency.licenses = [License.find_by_name("old")].to_set
152
159
 
153
- dependency.apply_better_license License.find_by_name("new license")
154
- dependency.license.name.should == "new license"
160
+ dependency.set_licenses [License.find_by_name("new license")].to_set
161
+ expect(dependency.licenses.first.name).to eq "new license"
155
162
  end
156
163
 
157
164
  it "won't update the database if the license isn't changing" do
158
165
  # See note in PackageSaver#save
159
- dependency.license = License.find_by_name("same")
160
- dependency.should be_modified
166
+ dependency.licenses = [License.find_by_name("same")].to_set
167
+ expect(dependency).to be_modified
168
+ dependency.save
169
+ expect(dependency).not_to be_modified
170
+
171
+ dependency.set_licenses [License.find_by_name("same")].to_set
172
+ expect(dependency).not_to be_modified
173
+ end
174
+
175
+ it "updates the database if an additional license is added" do
176
+ # See note in PackageSaver#save
177
+ dependency.licenses = [License.find_by_name("first")].to_set
178
+ expect(dependency).to be_modified
161
179
  dependency.save
162
- dependency.should_not be_modified
180
+ expect(dependency).not_to be_modified
163
181
 
164
- dependency.apply_better_license License.find_by_name("same")
165
- dependency.should_not be_modified
182
+ dependency.set_licenses [License.find_by_name("first"), License.find_by_name("second")].to_set
183
+ expect(dependency).to be_modified
166
184
  end
167
185
 
168
186
  it "does not change the approval" do
169
- dependency.license = License.find_by_name("old")
187
+ dependency.licenses = [License.find_by_name("old")].to_set
170
188
  dependency.approve!
171
189
 
172
- dependency.apply_better_license License.find_by_name("new license")
173
- dependency.should be_approved
190
+ dependency.set_licenses [License.find_by_name("new license")].to_set
191
+ expect(dependency).to be_approved
174
192
  end
175
193
  end
176
194
  end
@@ -27,25 +27,25 @@ module LicenseFinder
27
27
  describe ".needs_conversion?" do
28
28
  it "is true if the yml still exists" do
29
29
  yaml_file = double(:yaml_file, :exist? => true)
30
- LicenseFinder.config.artifacts.stub(legacy_yaml_file: yaml_file)
30
+ allow(LicenseFinder.config.artifacts).to receive_messages(legacy_yaml_file: yaml_file)
31
31
 
32
- described_class.needs_conversion?.should be_truthy
32
+ expect(described_class.needs_conversion?).to be_truthy
33
33
  end
34
34
 
35
35
  it "is false otherwise" do
36
36
  yaml_file = double(:yaml_file, :exist? => false)
37
- LicenseFinder.config.artifacts.stub(legacy_yaml_file: yaml_file)
37
+ allow(LicenseFinder.config.artifacts).to receive_messages(legacy_yaml_file: yaml_file)
38
38
 
39
- described_class.needs_conversion?.should be_falsey
39
+ expect(described_class.needs_conversion?).to be_falsey
40
40
  end
41
41
  end
42
42
 
43
43
  describe ".remove_yml" do
44
44
  it "removes the yml file" do
45
45
  yaml_file = double(:yaml_file)
46
- LicenseFinder.config.artifacts.stub(legacy_yaml_file: yaml_file)
46
+ allow(LicenseFinder.config.artifacts).to receive_messages(legacy_yaml_file: yaml_file)
47
47
 
48
- yaml_file.should_receive(:delete)
48
+ expect(yaml_file).to receive(:delete)
49
49
  described_class.remove_yml
50
50
  end
51
51
  end
@@ -62,7 +62,7 @@ module LicenseFinder
62
62
  described_class.convert_all([legacy_attributes])
63
63
 
64
64
  saved_dep = described_class::Sql::Dependency.first
65
- saved_dep.should_not be_added_manually
65
+ expect(saved_dep).not_to be_added_manually
66
66
  end
67
67
  end
68
68
 
@@ -73,36 +73,36 @@ module LicenseFinder
73
73
  described_class.convert_all([legacy_attributes])
74
74
 
75
75
  saved_dep = described_class::Sql::Dependency.first
76
- saved_dep.should be_added_manually
76
+ expect(saved_dep).to be_added_manually
77
77
  end
78
78
  end
79
79
 
80
80
  it "persists all of the dependency's attributes" do
81
81
  described_class.convert_all([legacy_attributes])
82
82
 
83
- described_class::Sql::Dependency.count.should == 1
83
+ expect(described_class::Sql::Dependency.count).to eq(1)
84
84
  saved_dep = described_class::Sql::Dependency.first
85
- saved_dep.name.should == "spec_name"
86
- saved_dep.version.should == "2.1.3"
87
- saved_dep.summary.should == "some summary"
88
- saved_dep.description.should == "some description"
89
- saved_dep.homepage.should == "www.homepage.com"
90
- saved_dep.manual_approval.should be
85
+ expect(saved_dep.name).to eq("spec_name")
86
+ expect(saved_dep.version).to eq("2.1.3")
87
+ expect(saved_dep.summary).to eq("some summary")
88
+ expect(saved_dep.description).to eq("some description")
89
+ expect(saved_dep.homepage).to eq("www.homepage.com")
90
+ expect(saved_dep.manual_approval).to be
91
91
  end
92
92
 
93
93
  it "associates the license to the dependency" do
94
94
  described_class.convert_all([legacy_attributes])
95
95
 
96
96
  saved_dep = described_class::Sql::Dependency.first
97
- saved_dep.license_name.should == "GPLv2"
97
+ expect(saved_dep.license_names).to eq("GPLv2")
98
98
  end
99
99
 
100
100
  it "associates bundler groups" do
101
101
  described_class.convert_all([legacy_attributes])
102
102
 
103
103
  saved_dep = described_class::Sql::Dependency.first
104
- saved_dep.bundler_groups.count.should == 1
105
- saved_dep.bundler_groups.first.name.should == 'test'
104
+ expect(saved_dep.bundler_groups.count).to eq(1)
105
+ expect(saved_dep.bundler_groups.first.name).to eq('test')
106
106
  end
107
107
 
108
108
  it "associates children" do
@@ -113,10 +113,10 @@ module LicenseFinder
113
113
  }
114
114
  described_class.convert_all([legacy_attributes, child_attrs])
115
115
 
116
- described_class::Sql::Dependency.count.should == 2
116
+ expect(described_class::Sql::Dependency.count).to eq(2)
117
117
  saved_dep = described_class::Sql::Dependency.first(name: 'spec_name')
118
- saved_dep.children.count.should == 1
119
- saved_dep.children.first.name.should == 'child1_name'
118
+ expect(saved_dep.children.count).to eq(1)
119
+ expect(saved_dep.children.first.name).to eq('child1_name')
120
120
  end
121
121
  end
122
122
  end
@@ -5,7 +5,7 @@ describe LicenseFinder do
5
5
  it "should load the configuration exactly once" do
6
6
  LicenseFinder.instance_variable_set(:@config, nil)
7
7
 
8
- LicenseFinder::Configuration.should_receive(:ensure_default).once.and_return(double(:config))
8
+ expect(LicenseFinder::Configuration).to receive(:ensure_default).once.and_return(double(:config))
9
9
 
10
10
  LicenseFinder.config
11
11
  LicenseFinder.config
data/spec/spec_helper.rb CHANGED
@@ -28,16 +28,3 @@ RSpec.configure do |config|
28
28
  end
29
29
  end
30
30
  end
31
-
32
- module LicenseFinder
33
- shared_examples "it conforms to interface required by PackageSaver" do
34
- it { expect { subject.name }.to_not raise_error }
35
- it { expect { subject.version }.to_not raise_error }
36
- it { expect { subject.summary }.to_not raise_error }
37
- it { expect { subject.description }.to_not raise_error }
38
- it { expect { subject.homepage }.to_not raise_error }
39
- it { expect { subject.groups }.to_not raise_error }
40
- it { expect { subject.children }.to_not raise_error }
41
- it { expect { subject.license }.to_not raise_error }
42
- end
43
- end