license_finder 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.rdoc +27 -3
- data/db/migrate/201307250917_add_license_manual_to_dependencies.rb +7 -0
- data/db/migrate/201307251004_data_fix_manual_licenses.rb +15 -0
- data/db/migrate/201307251107_reassociate_license.rb +23 -0
- data/db/migrate/201307251340_remove_manual_from_license_aliases.rb +7 -0
- data/features/cli.feature +1 -1
- data/features/html_report.feature +3 -2
- data/features/project_name.feature +10 -0
- data/features/set_license.feature +1 -0
- data/features/step_definitions/cli_steps.rb +3 -3
- data/features/step_definitions/project_name_steps.rb +3 -0
- data/features/step_definitions/set_license_steps.rb +9 -4
- data/features/step_definitions/shared_steps.rb +11 -2
- data/features/step_definitions/text_report_steps.rb +12 -2
- data/features/text_report.feature +7 -1
- data/files/dependency_breakdown.png +0 -0
- data/files/license_finder.yml +1 -0
- data/files/report_breakdown.png +0 -0
- data/lib/license_finder.rb +0 -5
- data/lib/license_finder/bundle.rb +22 -4
- data/lib/license_finder/bundled_gem.rb +17 -10
- data/lib/license_finder/bundled_gem_saver.rb +42 -30
- data/lib/license_finder/cli.rb +37 -5
- data/lib/license_finder/configuration.rb +13 -2
- data/lib/license_finder/dependency_manager.rb +21 -8
- data/lib/license_finder/reports/dependency_report.rb +1 -1
- data/lib/license_finder/reports/reporter.rb +4 -0
- data/lib/license_finder/tables/dependency.rb +9 -1
- data/lib/license_finder/tables/license_alias.rb +0 -4
- data/lib/license_finder/yml_to_sql.rb +1 -11
- data/lib/templates/html_report.erb +13 -3
- data/license_finder.gemspec +3 -4
- data/readme.md +25 -3
- data/release/gem_version.rb +3 -0
- data/{release.md → release/manual_instructions.md} +6 -0
- data/release/publish.sh +29 -0
- data/spec/lib/license_finder/bundle_spec.rb +16 -4
- data/spec/lib/license_finder/bundled_gem_saver_spec.rb +41 -38
- data/spec/lib/license_finder/bundled_gem_spec.rb +22 -4
- data/spec/lib/license_finder/cli_spec.rb +22 -0
- data/spec/lib/license_finder/configuration_spec.rb +34 -14
- data/spec/lib/license_finder/dependency_manager_spec.rb +61 -10
- data/spec/lib/license_finder/reporter_spec.rb +35 -1
- data/spec/lib/license_finder/tables/dependency_spec.rb +23 -0
- data/spec/lib/license_finder/tables/license_alias_spec.rb +0 -16
- data/spec/lib/license_finder/yml_to_sql_spec.rb +11 -3
- data/spec/lib/license_finder_spec.rb +2 -2
- data/spec/spec_helper.rb +3 -13
- metadata +21 -8
@@ -5,7 +5,7 @@ module LicenseFinder
|
|
5
5
|
let(:definition) do
|
6
6
|
double('definition', {
|
7
7
|
:dependencies => [],
|
8
|
-
:groups => [],
|
8
|
+
:groups => [:dev, :production],
|
9
9
|
:specs_for => [
|
10
10
|
build_gemspec('gem1', '1.2.3'),
|
11
11
|
build_gemspec('gem2', '0.4.2')
|
@@ -28,7 +28,13 @@ module LicenseFinder
|
|
28
28
|
|
29
29
|
describe '.current_gems' do
|
30
30
|
subject do
|
31
|
-
Bundle.current_gems(
|
31
|
+
Bundle.current_gems(config)
|
32
|
+
end
|
33
|
+
|
34
|
+
let(:config) { double(:config, ignore_groups: ['dev', 'test']) }
|
35
|
+
|
36
|
+
before do
|
37
|
+
Bundler::Definition.stub(:build).and_return(definition)
|
32
38
|
end
|
33
39
|
|
34
40
|
it "should have 2 dependencies" do
|
@@ -37,9 +43,9 @@ module LicenseFinder
|
|
37
43
|
|
38
44
|
context "when initialized with a parent and child gem" do
|
39
45
|
before do
|
40
|
-
definition.stub(:specs_for).and_return([
|
46
|
+
definition.stub(:specs_for).with([:production]).and_return([
|
41
47
|
build_gemspec('gem1', '1.2.3', 'gem2'),
|
42
|
-
build_gemspec('gem2', '0.4.2')
|
48
|
+
build_gemspec('gem2', '0.4.2', 'gem3')
|
43
49
|
])
|
44
50
|
end
|
45
51
|
|
@@ -48,6 +54,12 @@ module LicenseFinder
|
|
48
54
|
|
49
55
|
gem1.children.should == ["gem2"]
|
50
56
|
end
|
57
|
+
|
58
|
+
it "should only include the children which are project dependencies" do
|
59
|
+
gem2 = subject[1]
|
60
|
+
|
61
|
+
gem2.children.should == []
|
62
|
+
end
|
51
63
|
end
|
52
64
|
end
|
53
65
|
end
|
@@ -14,9 +14,22 @@ module LicenseFinder
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
describe ".save_gems" do
|
18
|
+
let(:bundled_gems) { [gem] }
|
19
|
+
let(:gem) { double(:bundled_gem) }
|
20
|
+
|
21
|
+
it "calls find_or_create_by_name on all passed in gems" do
|
22
|
+
described_class.should_receive(:find_or_create_by_name).with(gem).and_return(gem)
|
23
|
+
gem.should_receive(:save)
|
24
|
+
described_class.save_gems(bundled_gems)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
17
28
|
describe "#save" do
|
18
29
|
let(:bundled_gem) { BundledGem.new(gemspec) }
|
19
|
-
subject { described_class.find_or_create_by_name(
|
30
|
+
subject { described_class.find_or_create_by_name(bundled_gem).save }
|
31
|
+
|
32
|
+
before { bundled_gem.children = ["foo"] }
|
20
33
|
|
21
34
|
context "when the dependency is new" do
|
22
35
|
it "persists gem data" do
|
@@ -29,20 +42,9 @@ module LicenseFinder
|
|
29
42
|
end
|
30
43
|
|
31
44
|
describe "associating children" do
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
it "associates children" do
|
36
|
-
subject.children.map(&:name).should == ['foo']
|
37
|
-
subject.children.each { |child| child.id.should_not be_nil }
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context "when the child is not in Bundler's current gems" do
|
42
|
-
it "does not associates children" do
|
43
|
-
subject.children.map(&:name).should == []
|
44
|
-
subject.children.each { |child| child.id.should be_nil }
|
45
|
-
end
|
45
|
+
it "associates children" do
|
46
|
+
subject.children.map(&:name).should == ['foo']
|
47
|
+
subject.children.each { |child| child.id.should_not be_nil }
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
@@ -76,7 +78,7 @@ module LicenseFinder
|
|
76
78
|
license: license
|
77
79
|
)
|
78
80
|
end
|
79
|
-
let(:bundled_gem_saver) { described_class.find_or_create_by_name(
|
81
|
+
let(:bundled_gem_saver) { described_class.find_or_create_by_name(bundled_gem) }
|
80
82
|
|
81
83
|
it "does not save the dependency" do
|
82
84
|
bundled_gem_saver.dependency.should_not_receive(:save)
|
@@ -107,7 +109,8 @@ module LicenseFinder
|
|
107
109
|
end
|
108
110
|
|
109
111
|
it "keeps a manually assigned license" do
|
110
|
-
old_copy.license = LicenseAlias.create(name: 'foo'
|
112
|
+
old_copy.license = LicenseAlias.create(name: 'foo')
|
113
|
+
old_copy.license_manual = true
|
111
114
|
old_copy.save
|
112
115
|
subject.license.name.should == 'foo'
|
113
116
|
end
|
@@ -115,7 +118,12 @@ module LicenseFinder
|
|
115
118
|
it "keeps approval" do
|
116
119
|
old_copy.approval = Approval.create(state: true)
|
117
120
|
old_copy.save
|
118
|
-
subject.approval.state.should
|
121
|
+
subject.approval.state.should
|
122
|
+
if LicenseFinder::Platform.java?
|
123
|
+
subject.approval.state.should == 1
|
124
|
+
else
|
125
|
+
subject.approval.state.should == true
|
126
|
+
end
|
119
127
|
end
|
120
128
|
|
121
129
|
it "ensures correct children are associated" do
|
@@ -126,19 +134,20 @@ module LicenseFinder
|
|
126
134
|
end
|
127
135
|
|
128
136
|
context "with a bundler dependency" do
|
129
|
-
let(:bundled_gem) { BundledGem.new(gemspec, double(:bundler_dependency
|
137
|
+
let(:bundled_gem) { BundledGem.new(gemspec, double(:bundler_dependency)) }
|
130
138
|
|
131
139
|
before do
|
140
|
+
bundled_gem.stub(:groups) { [:group_1, :group_2, :b] }
|
132
141
|
old_copy.add_bundler_group BundlerGroup.find_or_create(name: 'a')
|
133
142
|
old_copy.add_bundler_group BundlerGroup.find_or_create(name: 'b')
|
134
143
|
end
|
135
144
|
|
136
145
|
it "ensures the correct bundler groups are associated" do
|
137
|
-
subject.bundler_groups.map(&:name).should =~ %w[
|
146
|
+
subject.bundler_groups.map(&:name).should =~ %w[group_1 group_2 b]
|
138
147
|
end
|
139
148
|
end
|
140
149
|
|
141
|
-
context "license
|
150
|
+
context "license has changed" do
|
142
151
|
before do
|
143
152
|
old_copy.license = LicenseAlias.create(name: 'other')
|
144
153
|
old_copy.save
|
@@ -158,27 +167,17 @@ module LicenseFinder
|
|
158
167
|
subject.should_not be_approved
|
159
168
|
end
|
160
169
|
end
|
161
|
-
end
|
162
170
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
gemspec.license = "other"
|
169
|
-
end
|
170
|
-
|
171
|
-
it "should not change the license" do
|
172
|
-
subject.license.name.should == 'MIT'
|
173
|
-
end
|
174
|
-
|
175
|
-
it "should not change the approval" do
|
176
|
-
subject.should_not be_approved
|
171
|
+
context "license already exists" do
|
172
|
+
it "uses the existing license" do
|
173
|
+
new_license = LicenseAlias.create(name: 'new license')
|
174
|
+
subject.license.should == new_license
|
175
|
+
end
|
177
176
|
end
|
178
177
|
end
|
179
178
|
|
180
179
|
context "license does not change" do
|
181
|
-
let(:bundled_gem_saver) { described_class.find_or_create_by_name(
|
180
|
+
let(:bundled_gem_saver) { described_class.find_or_create_by_name(bundled_gem) }
|
182
181
|
|
183
182
|
before do
|
184
183
|
old_copy.license = LicenseAlias.create(name: 'MIT')
|
@@ -189,7 +188,11 @@ module LicenseFinder
|
|
189
188
|
|
190
189
|
it "should not change the license or approval" do
|
191
190
|
dependency = bundled_gem_saver.save
|
192
|
-
|
191
|
+
if LicenseFinder::Platform.java?
|
192
|
+
dependency.approved?.should_not == 1
|
193
|
+
else
|
194
|
+
dependency.should_not be_approved
|
195
|
+
end
|
193
196
|
dependency.license.name.should == "MIT"
|
194
197
|
end
|
195
198
|
|
@@ -24,7 +24,7 @@ module LicenseFinder
|
|
24
24
|
its(:dependency_name) { should == 'spec_name' }
|
25
25
|
its(:dependency_version) { should == '2.1.3' }
|
26
26
|
|
27
|
-
describe "#
|
27
|
+
describe "#license" do
|
28
28
|
subject do
|
29
29
|
details = BundledGem.new(gemspec)
|
30
30
|
details.stub(:license_files).and_return([license_file])
|
@@ -36,19 +36,19 @@ module LicenseFinder
|
|
36
36
|
it "returns the license from the gemspec if provided" do
|
37
37
|
gemspec.stub(:license).and_return('Some License')
|
38
38
|
|
39
|
-
subject.
|
39
|
+
subject.license.should == "Some License"
|
40
40
|
end
|
41
41
|
|
42
42
|
it "returns the matched license if detected" do
|
43
43
|
license_file.stub(:license).and_return('Detected License')
|
44
44
|
|
45
|
-
subject.
|
45
|
+
subject.license.should == "Detected License"
|
46
46
|
end
|
47
47
|
|
48
48
|
it "returns 'other' otherwise" do
|
49
49
|
license_file.stub(:license).and_return(nil)
|
50
50
|
|
51
|
-
subject.
|
51
|
+
subject.license.should == "other"
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -58,5 +58,23 @@ module LicenseFinder
|
|
58
58
|
subject.license_files
|
59
59
|
end
|
60
60
|
end
|
61
|
+
|
62
|
+
describe "#groups" do
|
63
|
+
context "bundler_dependency is present" do
|
64
|
+
subject { described_class.new(gemspec, bundler_dependency) }
|
65
|
+
|
66
|
+
let(:bundler_dependency) { double(:dependency, groups: [1, 2, 3]) }
|
67
|
+
|
68
|
+
it "returns bundler dependency's groups" do
|
69
|
+
subject.groups.should == bundler_dependency.groups
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context "bundler_dependency is nil" do
|
74
|
+
it "returns empty array" do
|
75
|
+
subject.groups.should == []
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
61
79
|
end
|
62
80
|
end
|
@@ -57,6 +57,7 @@ module LicenseFinder
|
|
57
57
|
it "adds the specified license to the whitelist" do
|
58
58
|
config.whitelist.should_receive(:push).with("test")
|
59
59
|
config.should_receive(:save)
|
60
|
+
Reporter.should_receive(:write_reports)
|
60
61
|
|
61
62
|
silence_stdout do
|
62
63
|
subject.add("test")
|
@@ -68,6 +69,7 @@ module LicenseFinder
|
|
68
69
|
it "removes the specified license from the whitelist" do
|
69
70
|
config.should_receive(:save)
|
70
71
|
config.whitelist.should_receive(:delete).with("test")
|
72
|
+
Reporter.should_receive(:write_reports)
|
71
73
|
|
72
74
|
silence_stdout do
|
73
75
|
subject.remove("test")
|
@@ -76,6 +78,24 @@ module LicenseFinder
|
|
76
78
|
end
|
77
79
|
end
|
78
80
|
|
81
|
+
describe ProjectName do
|
82
|
+
let(:config) { LicenseFinder.config }
|
83
|
+
|
84
|
+
describe "set" do
|
85
|
+
it "sets the project name" do
|
86
|
+
config.should_receive(:save)
|
87
|
+
config.project_name.should_not eq("new_project_name")
|
88
|
+
Reporter.should_receive(:write_reports)
|
89
|
+
|
90
|
+
silence_stdout do
|
91
|
+
subject.set("new_project_name")
|
92
|
+
end
|
93
|
+
|
94
|
+
config.project_name.should eq("new_project_name")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
79
99
|
describe IgnoredBundlerGroups do
|
80
100
|
let(:config) { LicenseFinder.config }
|
81
101
|
|
@@ -93,6 +113,7 @@ module LicenseFinder
|
|
93
113
|
it "adds the specified group to the ignored groups list" do
|
94
114
|
config.ignore_groups.should_receive(:push).with("test")
|
95
115
|
config.should_receive(:save)
|
116
|
+
Reporter.should_receive(:write_reports)
|
96
117
|
|
97
118
|
silence_stdout do
|
98
119
|
subject.add("test")
|
@@ -104,6 +125,7 @@ module LicenseFinder
|
|
104
125
|
it "removes the specified group from the ignored groups list" do
|
105
126
|
config.ignore_groups.should_receive(:delete).with("test")
|
106
127
|
config.should_receive(:save)
|
128
|
+
Reporter.should_receive(:write_reports)
|
107
129
|
|
108
130
|
silence_stdout do
|
109
131
|
subject.remove("test")
|
@@ -11,7 +11,8 @@ module LicenseFinder
|
|
11
11
|
{
|
12
12
|
"whitelist" => ["FooLicense", "BarLicense"],
|
13
13
|
"ignore_groups" => [:test, :development],
|
14
|
-
"dependencies_file_dir" => "."
|
14
|
+
"dependencies_file_dir" => ".",
|
15
|
+
"project_name" => "my_app"
|
15
16
|
}
|
16
17
|
end
|
17
18
|
|
@@ -22,6 +23,7 @@ module LicenseFinder
|
|
22
23
|
subject.whitelist.should == attributes['whitelist']
|
23
24
|
subject.ignore_groups.should == attributes['ignore_groups']
|
24
25
|
subject.dependencies_dir.should == attributes['dependencies_file_dir']
|
26
|
+
subject.project_name.should == attributes['project_name']
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
@@ -39,6 +41,19 @@ module LicenseFinder
|
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
44
|
+
describe "#project_name" do
|
45
|
+
let(:directory_name) { "test_dir" }
|
46
|
+
|
47
|
+
before do
|
48
|
+
Configuration.stub(:config_hash).and_return({})
|
49
|
+
Dir.stub(:getwd).and_return("/path/to/#{directory_name}")
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should default to the directory name" do
|
53
|
+
klass.new.project_name.should == directory_name
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
42
57
|
describe "whitelisted?" do
|
43
58
|
context "canonical name whitelisted" do
|
44
59
|
before { config.whitelist = [License::Apache2.names[rand(License::Apache2.names.count)]]}
|
@@ -61,32 +76,39 @@ module LicenseFinder
|
|
61
76
|
|
62
77
|
describe "#save" do
|
63
78
|
let(:tmp_yml) { '.tmp.configuration_spec.yml' }
|
79
|
+
let(:yaml) { YAML.load(File.read(tmp_yml)) }
|
64
80
|
|
65
81
|
before do
|
66
82
|
Configuration.stub(:config_file_path).and_return(tmp_yml)
|
67
83
|
config.whitelist = ['my_gem']
|
68
84
|
config.ignore_groups = ['other_group', 'test']
|
85
|
+
config.project_name = "New Project Name"
|
86
|
+
config.dependencies_dir = "./deps"
|
69
87
|
end
|
70
88
|
|
71
89
|
after do
|
72
90
|
File.delete(tmp_yml)
|
73
91
|
end
|
74
92
|
|
75
|
-
|
76
|
-
config.save
|
77
|
-
|
78
|
-
yaml = YAML.load(File.read(tmp_yml))
|
93
|
+
describe "writes the configuration attributes to the yaml file" do
|
94
|
+
before { config.save }
|
79
95
|
|
80
|
-
|
81
|
-
|
96
|
+
it "writes the whitelist" do
|
97
|
+
yaml["whitelist"].should include("my_gem")
|
98
|
+
end
|
82
99
|
|
83
|
-
|
84
|
-
|
100
|
+
it "writes the ignored bundler groups" do
|
101
|
+
yaml["ignore_groups"].should include("other_group")
|
102
|
+
yaml["ignore_groups"].should include("test")
|
103
|
+
end
|
85
104
|
|
86
|
-
|
105
|
+
it "writes the dependencies_dir" do
|
106
|
+
yaml["dependencies_file_dir"].should eq("./deps")
|
107
|
+
end
|
87
108
|
|
88
|
-
|
89
|
-
|
109
|
+
it "writes the project name" do
|
110
|
+
yaml["project_name"].should eq("New Project Name")
|
111
|
+
end
|
90
112
|
end
|
91
113
|
|
92
114
|
it "doesn't write duplicate entries" do
|
@@ -95,8 +117,6 @@ module LicenseFinder
|
|
95
117
|
|
96
118
|
config.save
|
97
119
|
|
98
|
-
yaml = YAML.load(File.read(tmp_yml))
|
99
|
-
|
100
120
|
yaml["whitelist"].count("my_gem").should == 1
|
101
121
|
yaml["ignore_groups"].count("test").should == 1
|
102
122
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'digest'
|
2
3
|
|
3
4
|
module LicenseFinder
|
4
5
|
describe DependencyManager do
|
@@ -11,6 +12,9 @@ module LicenseFinder
|
|
11
12
|
end
|
12
13
|
|
13
14
|
describe "#sync_with_bundler" do
|
15
|
+
let(:gem1) { double(:bundled_gem) }
|
16
|
+
let(:gem2) { double(:bundled_gem) }
|
17
|
+
|
14
18
|
it "destroys every dependency except for the ones Bundler reports as 'current' or are marked as 'manual'" do
|
15
19
|
cur1 = Dependency.create(name: "current dependency 1")
|
16
20
|
cur2 = Dependency.create(name: "current dependency 2")
|
@@ -18,11 +22,9 @@ module LicenseFinder
|
|
18
22
|
Dependency.create(name: "old dependency 1")
|
19
23
|
Dependency.create(name: "old dependency 2")
|
20
24
|
|
21
|
-
current_gems = [
|
22
|
-
|
23
|
-
|
24
|
-
]
|
25
|
-
LicenseFinder.stub(:current_gems) { current_gems }
|
25
|
+
current_gems = [gem1, gem2]
|
26
|
+
Bundle.stub(:current_gems).with(config) { current_gems }
|
27
|
+
BundledGemSaver.should_receive(:save_gems).with(current_gems).and_return([cur1, cur2])
|
26
28
|
|
27
29
|
described_class.sync_with_bundler
|
28
30
|
Dependency.all.map(&:name).should =~ [cur1, cur2, man1].map(&:name)
|
@@ -89,11 +91,12 @@ module LicenseFinder
|
|
89
91
|
end
|
90
92
|
|
91
93
|
describe ".license!" do
|
94
|
+
let(:dependency) { double(:dependency) }
|
95
|
+
|
92
96
|
it "adds a license for the dependency" do
|
93
|
-
|
94
|
-
|
95
|
-
described_class.license!("
|
96
|
-
dep.reload.license.name.should == "a license"
|
97
|
+
DependencyManager.stub(:find_by_name).with("dependency").and_return(dependency)
|
98
|
+
dependency.should_receive(:set_license_manually!).with("MIT")
|
99
|
+
described_class.license!("dependency", "MIT")
|
97
100
|
end
|
98
101
|
|
99
102
|
it "should raise an error if it can't find the dependency" do
|
@@ -102,6 +105,54 @@ module LicenseFinder
|
|
102
105
|
end
|
103
106
|
end
|
104
107
|
|
108
|
+
describe ".modifying" do
|
109
|
+
context "when the database doesn't exist" do
|
110
|
+
before { File.stub(:exists?) { false } }
|
111
|
+
|
112
|
+
it "writes reports" do
|
113
|
+
Reporter.should_receive(:write_reports)
|
114
|
+
DependencyManager.modifying {}
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
context "when the database exists" do
|
119
|
+
before { File.stub(:exists?) { true } }
|
120
|
+
|
121
|
+
context "when the database has changed" do
|
122
|
+
before do
|
123
|
+
i = 0
|
124
|
+
Digest::SHA2.stub_chain(:file, :hexdigest) { i += 1 }
|
125
|
+
end
|
126
|
+
|
127
|
+
it "writes reports" do
|
128
|
+
Reporter.should_receive(:write_reports)
|
129
|
+
DependencyManager.modifying {}
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
context "when the database has not changed" do
|
134
|
+
before do
|
135
|
+
Digest::SHA2.stub_chain(:file, :hexdigest) { 5 }
|
136
|
+
end
|
137
|
+
|
138
|
+
it "does not write reports" do
|
139
|
+
Reporter.should_not_receive(:write_reports)
|
140
|
+
DependencyManager.modifying {}
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
context "when the reports do not exist" do
|
145
|
+
before do
|
146
|
+
Digest::SHA2.stub_chain(:file, :hexdigest) { 5 }
|
147
|
+
File.stub(:exists?).with(LicenseFinder.config.dependencies_html) { false }
|
148
|
+
end
|
149
|
+
|
150
|
+
it "writes reports" do
|
151
|
+
Reporter.should_receive(:write_reports)
|
152
|
+
DependencyManager.modifying {}
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
105
157
|
end
|
106
158
|
end
|
107
|
-
|