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
@@ -93,7 +93,7 @@ module LicenseFinder
93
93
  'summary' => 'summary',
94
94
  'description' => 'description',
95
95
  'homepage' => 'homepage',
96
- 'license' => 'license_name'
96
+ 'license' => 'license_names'
97
97
  }
98
98
 
99
99
  def self.convert(attrs)
@@ -52,7 +52,7 @@
52
52
  <a href='#<%= dependency.name %>'>
53
53
  <%= dependency.name %>
54
54
  </a>
55
- (<%= dependency.license.name %>)
55
+ (<%= dependency.licenses.map(&:name).join(', ') %>)
56
56
  </li>
57
57
  <% end -%>
58
58
  </ul>
@@ -66,7 +66,7 @@
66
66
  <blockquote class="pull-right">
67
67
  <% if dependency.approved_manually? -%>
68
68
  <p>
69
- <%= link_to_license(dependency.license) %>
69
+ <%= dependency.licenses.map { |l| link_to_license(l) }.join(', ') %>
70
70
  manually approved
71
71
  <span class="badge badge-success">&#x2713;</span>
72
72
  </p>
@@ -79,13 +79,13 @@
79
79
  </small>
80
80
  <% elsif dependency.whitelisted? -%>
81
81
  <p>
82
- <%= link_to_license(dependency.license) %>
82
+ <%= dependency.licenses.map { |l| link_to_license(l) }.join(', ') %>
83
83
  whitelisted
84
84
  <span class="badge badge-success">&#x2713;</span>
85
85
  </p>
86
86
  <% else -%>
87
87
  <p>
88
- <%= link_to_license(dependency.license) %>
88
+ <%= dependency.licenses.map { |l| link_to_license(l) }.join(', ') %>
89
89
  unapproved
90
90
  <span class="badge badge-important">&#x2717;</span>
91
91
  </p>
@@ -12,7 +12,7 @@ As of <%= Time.now.strftime("%B %e, %Y %l:%M%P") %>. <%= dependencies.size %> to
12
12
  <%= unapproved_dependencies.size %> *unapproved*
13
13
 
14
14
  <% unapproved_dependencies.each do |dependency| -%>
15
- * <a href='#<%= dependency.name %>'><%= dependency.name %></a> (<%= dependency.license.name %>)
15
+ * <a href='#<%= dependency.name %>'><%= dependency.name %></a> (<%= dependency.licenses.map(&:name) %>)
16
16
  <% end %>
17
17
  <% end -%>
18
18
 
@@ -25,15 +25,15 @@ As of <%= Time.now.strftime("%B %e, %Y %l:%M%P") %>. <%= dependencies.size %> to
25
25
  #### <%= dependency.summary %>
26
26
 
27
27
  <% if dependency.approved_manually? -%>
28
- <%= link_to_license(dependency.license) %> manually approved
28
+ <%= dependency.licenses.map { |l| link_to_license(l) }.join(', ') %> manually approved
29
29
 
30
30
  ><%= dependency.manual_approval.notes %>
31
31
 
32
32
  ><cite> <%= dependency.manual_approval.approver %> <%= dependency.manual_approval.safe_created_at.to_date %></cite>
33
33
  <% elsif dependency.whitelisted? -%>
34
- <%= link_to_license(dependency.license) %> whitelisted
34
+ <%= dependency.licenses.map { |l| link_to_license(l) }.join(', ') %> whitelisted
35
35
  <% else -%>
36
- <%= link_to_license(dependency.license) %> _**unapproved**_
36
+ <%= dependency.licenses.map { |l| link_to_license(l) }.join(', ') %> _**unapproved**_
37
37
  <% end -%>
38
38
 
39
39
  <% if dependency.description -%>
@@ -1,3 +1,3 @@
1
1
  <% sorted_dependencies.each do |s| -%>
2
- <%=s.name %>, <%=s.version %>, <%=s.license.name%>
2
+ <%=s.name %>, <%=s.version %>, <%=s.licenses.map(&:name).join(', ')%>
3
3
  <% end -%>
@@ -3,18 +3,33 @@ require './lib/license_finder/platform'
3
3
  Gem::Specification.new do |s|
4
4
  s.required_ruby_version = '>= 1.9.3'
5
5
  s.name = "license_finder"
6
- s.version = "1.1.1"
7
- s.authors = ["Jacob Maine", "Matthew Kane Parker", "Ian Lesperance", "David Edwards", "Paul Meskers", "Brent Wheeldon", "Trevor John", "David Tengdin", "William Ramsey", "David Dening", "Geoff Pleiss", "Mike Chinigo"]
6
+ s.version = "1.2"
7
+
8
+ s.authors = [
9
+ "Jacob Maine",
10
+ "Matthew Kane Parker",
11
+ "Ian Lesperance",
12
+ "David Edwards",
13
+ "Paul Meskers",
14
+ "Brent Wheeldon",
15
+ "Trevor John",
16
+ "David Tengdin",
17
+ "William Ramsey",
18
+ "David Dening",
19
+ "Geoff Pleiss",
20
+ "Mike Chinigo",
21
+ "Mike Dalessio"
22
+ ]
23
+
8
24
  s.email = ["commoncode@pivotalabs.com"]
9
25
  s.homepage = "https://github.com/pivotal/LicenseFinder"
10
26
  s.summary = "Audit the OSS licenses of your application's dependencies."
11
27
 
12
28
  s.description = <<-DESCRIPTION
13
- Do you know the licenses of all your application's dependencies? What open source software licenses will your business accept?
14
-
15
- LicenseFinder culls your package managers, detects the licenses of the packages in them, and gives you a report that you can act on. If you already know
16
- what licenses your business is comfortable with, you can whitelist them, leaving you with an action report of only those dependencies that have
17
- licenses that fall outside of the whitelist.
29
+ LicenseFinder works with your package managers to find
30
+ dependencies, detect the licenses of the packages in them, compare
31
+ those licenses against a user-defined whitelist, and give you an
32
+ actionable exception report.
18
33
  DESCRIPTION
19
34
 
20
35
  s.license = "MIT"
@@ -26,14 +41,15 @@ Gem::Specification.new do |s|
26
41
  s.add_dependency "xml-simple"
27
42
  s.add_dependency LicenseFinder::Platform.sqlite_gem
28
43
 
29
- %w(rake rspec-its xpath cucumber pry).each do |gem|
30
- s.add_development_dependency gem
31
- end
32
-
44
+ s.add_development_dependency "rake"
45
+ s.add_development_dependency "rspec-its"
46
+ s.add_development_dependency "xpath"
47
+ s.add_development_dependency "cucumber"
48
+ s.add_development_dependency "pry"
33
49
  s.add_development_dependency "rspec", "~> 3"
34
50
  s.add_development_dependency "capybara", "~> 2.0.0"
35
51
  s.add_development_dependency "webmock", "~> 1.13"
36
- s.add_development_dependency "cocoapods" if RUBY_PLATFORM =~ /darwin/
52
+ s.add_development_dependency "cocoapods" if LicenseFinder::Platform.darwin?
37
53
 
38
54
  s.files = `git ls-files`.split("\n")
39
55
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -2,286 +2,294 @@ require "spec_helper"
2
2
 
3
3
  module LicenseFinder
4
4
  module CLI
5
- describe Dependencies do
6
- describe "add" do
7
- it "adds a dependency" do
8
- DependencyManager.should_receive(:manually_add).with("MIT", "js_dep", "1.2.3")
5
+ context do
6
+ let!(:dependency_manager) { DependencyManager.new }
9
7
 
10
- silence_stdout do
11
- subject.add("MIT", "js_dep", "1.2.3")
8
+ before do
9
+ allow(DependencyManager).to receive(:new) { dependency_manager }
10
+ end
11
+
12
+ describe Dependencies do
13
+ describe "add" do
14
+ it "adds a dependency" do
15
+ expect(dependency_manager).to receive(:manually_add).with("MIT", "js_dep", "1.2.3")
16
+
17
+ silence_stdout do
18
+ subject.add("MIT", "js_dep", "1.2.3")
19
+ end
12
20
  end
13
- end
14
21
 
15
- it "does not require a version" do
16
- DependencyManager.should_receive(:manually_add).with("MIT", "js_dep", nil)
22
+ it "does not require a version" do
23
+ expect(dependency_manager).to receive(:manually_add).with("MIT", "js_dep", nil)
17
24
 
18
- silence_stdout do
19
- subject.add("MIT", "js_dep")
25
+ silence_stdout do
26
+ subject.add("MIT", "js_dep")
27
+ end
20
28
  end
21
- end
22
29
 
23
- it "has an --approve option to approve the added dependency" do
24
- DependencyManager.should_receive(:manually_add).with("MIT", "js_dep", "1.2.3")
25
- DependencyManager.should_receive(:approve!).with("js_dep", "Julian", "We really need this")
30
+ it "has an --approve option to approve the added dependency" do
31
+ expect(dependency_manager).to receive(:manually_add).with("MIT", "js_dep", "1.2.3")
32
+ expect(dependency_manager).to receive(:approve!).with("js_dep", "Julian", "We really need this")
26
33
 
27
- silence_stdout do
28
- Main.start(["dependencies", "add", "--approve", "--approver", "Julian", "--message", "We really need this", "MIT", "js_dep", "1.2.3"])
34
+ silence_stdout do
35
+ Main.start(["dependencies", "add", "--approve", "--approver", "Julian", "--message", "We really need this", "MIT", "js_dep", "1.2.3"])
36
+ end
29
37
  end
30
38
  end
31
- end
32
39
 
33
- describe "remove" do
34
- it "removes a dependency" do
35
- DependencyManager.should_receive(:manually_remove).with("js_dep")
36
- silence_stdout do
37
- subject.remove("js_dep")
40
+ describe "remove" do
41
+ it "removes a dependency" do
42
+ expect(dependency_manager).to receive(:manually_remove).with("js_dep")
43
+ silence_stdout do
44
+ subject.remove("js_dep")
45
+ end
38
46
  end
39
47
  end
40
48
  end
41
- end
42
49
 
43
- describe Whitelist do
44
- let(:config) { LicenseFinder.config }
50
+ describe Whitelist do
51
+ let(:config) { LicenseFinder.config }
45
52
 
46
- describe "list" do
47
- it "shows the whitelist of licenses" do
48
- config.should_receive(:whitelist).and_return([])
53
+ describe "list" do
54
+ it "shows the whitelist of licenses" do
55
+ expect(config).to receive(:whitelist).and_return([])
49
56
 
50
- silence_stdout do
51
- subject.list
57
+ silence_stdout do
58
+ subject.list
59
+ end
52
60
  end
53
61
  end
54
- end
55
62
 
56
- describe "add" do
57
- it "adds the specified license to the whitelist" do
58
- config.whitelist.should_receive(:push).with("test")
59
- config.should_receive(:save)
60
- expect(DependencyManager).to receive(:sync_with_package_managers)
63
+ describe "add" do
64
+ it "adds the specified license to the whitelist" do
65
+ expect(config.whitelist).to receive(:push).with("test")
66
+ expect(config).to receive(:save)
67
+ expect(dependency_manager).to receive(:sync_with_package_managers)
61
68
 
62
- silence_stdout do
63
- subject.add("test")
69
+ silence_stdout do
70
+ subject.add("test")
71
+ end
64
72
  end
65
- end
66
73
 
67
- it "adds multiple licenses to the whitelist" do
68
- config.whitelist.should_receive(:push).with("test")
69
- config.whitelist.should_receive(:push).with("rest")
70
- config.should_receive(:save)
71
- expect(DependencyManager).to receive(:sync_with_package_managers)
74
+ it "adds multiple licenses to the whitelist" do
75
+ expect(config.whitelist).to receive(:push).with("test")
76
+ expect(config.whitelist).to receive(:push).with("rest")
77
+ expect(config).to receive(:save)
78
+ expect(dependency_manager).to receive(:sync_with_package_managers)
72
79
 
73
- silence_stdout do
74
- subject.add("test", "rest")
80
+ silence_stdout do
81
+ subject.add("test", "rest")
82
+ end
75
83
  end
76
84
  end
77
- end
78
85
 
79
- describe "remove" do
80
- it "removes the specified license from the whitelist" do
81
- config.should_receive(:save)
82
- config.whitelist.should_receive(:delete).with("test")
83
- expect(DependencyManager).to receive(:sync_with_package_managers)
86
+ describe "remove" do
87
+ it "removes the specified license from the whitelist" do
88
+ expect(config).to receive(:save)
89
+ expect(config.whitelist).to receive(:delete).with("test")
90
+ expect(dependency_manager).to receive(:sync_with_package_managers)
84
91
 
85
- silence_stdout do
92
+ silence_stdout do
86
93
 
87
- subject.remove("test")
94
+ subject.remove("test")
95
+ end
88
96
  end
89
- end
90
97
 
91
- it "removes multiple licenses from the whitelist" do
92
- config.should_receive(:save)
93
- config.whitelist.should_receive(:delete).with("test")
94
- config.whitelist.should_receive(:delete).with("rest")
95
- expect(DependencyManager).to receive(:sync_with_package_managers)
98
+ it "removes multiple licenses from the whitelist" do
99
+ expect(config).to receive(:save)
100
+ expect(config.whitelist).to receive(:delete).with("test")
101
+ expect(config.whitelist).to receive(:delete).with("rest")
102
+ expect(dependency_manager).to receive(:sync_with_package_managers)
96
103
 
97
- silence_stdout do
98
- subject.remove("test", "rest")
104
+ silence_stdout do
105
+ subject.remove("test", "rest")
106
+ end
99
107
  end
100
108
  end
101
109
  end
102
- end
103
110
 
104
- describe ProjectName do
105
- let(:config) { LicenseFinder.config }
111
+ describe ProjectName do
112
+ let(:config) { LicenseFinder.config }
106
113
 
107
- describe "set" do
108
- it "sets the project name" do
109
- config.should_receive(:save)
110
- config.project_name.should_not eq("new_project_name")
111
- expect(DependencyManager).to receive(:sync_with_package_managers)
114
+ describe "set" do
115
+ it "sets the project name" do
116
+ expect(config).to receive(:save)
117
+ expect(config.project_name).not_to eq("new_project_name")
118
+ expect(dependency_manager).to receive(:sync_with_package_managers)
112
119
 
113
- silence_stdout do
114
- subject.set("new_project_name")
115
- end
120
+ silence_stdout do
121
+ subject.set("new_project_name")
122
+ end
116
123
 
117
- config.project_name.should eq("new_project_name")
124
+ expect(config.project_name).to eq("new_project_name")
125
+ end
118
126
  end
119
127
  end
120
- end
121
128
 
122
- describe IgnoredBundlerGroups do
123
- let(:config) { LicenseFinder.config }
129
+ describe IgnoredBundlerGroups do
130
+ let(:config) { LicenseFinder.config }
124
131
 
125
- describe "list" do
126
- it "shows the ignored groups in the standard output" do
127
- config.should_receive(:ignore_groups).and_return(['development'])
132
+ describe "list" do
133
+ it "shows the ignored groups in the standard output" do
134
+ expect(config).to receive(:ignore_groups).and_return(['development'])
128
135
 
129
- expect(capture_stdout { subject.list }).to match /development/
136
+ expect(capture_stdout { subject.list }).to match /development/
137
+ end
130
138
  end
131
- end
132
139
 
133
- describe "add" do
134
- it "adds the specified group to the ignored groups list" do
135
- config.ignore_groups.should_receive(:push).with("test")
136
- config.should_receive(:save)
137
- expect(DependencyManager).to receive(:sync_with_package_managers)
140
+ describe "add" do
141
+ it "adds the specified group to the ignored groups list" do
142
+ expect(config.ignore_groups).to receive(:push).with("test")
143
+ expect(config).to receive(:save)
144
+ expect(dependency_manager).to receive(:sync_with_package_managers)
138
145
 
139
- silence_stdout do
140
- subject.add("test")
146
+ silence_stdout do
147
+ subject.add("test")
148
+ end
141
149
  end
142
150
  end
143
- end
144
151
 
145
- describe "remove" do
146
- it "removes the specified group from the ignored groups list" do
147
- config.ignore_groups.should_receive(:delete).with("test")
148
- config.should_receive(:save)
149
- expect(DependencyManager).to receive(:sync_with_package_managers)
152
+ describe "remove" do
153
+ it "removes the specified group from the ignored groups list" do
154
+ expect(config.ignore_groups).to receive(:delete).with("test")
155
+ expect(config).to receive(:save)
156
+ expect(dependency_manager).to receive(:sync_with_package_managers)
150
157
 
151
- silence_stdout do
152
- subject.remove("test")
158
+ silence_stdout do
159
+ subject.remove("test")
160
+ end
153
161
  end
154
162
  end
155
163
  end
156
- end
157
164
 
158
- describe IgnoredDependencies do
159
- let(:config) { LicenseFinder.config }
165
+ describe IgnoredDependencies do
166
+ let(:config) { LicenseFinder.config }
160
167
 
161
- describe "list" do
162
- context "when there is at least one ignored dependency" do
163
- it "shows the ignored dependencies" do
164
- expect(config).to receive(:ignore_dependencies).and_return(['bundler'])
165
- expect(capture_stdout { subject.list }).to match /bundler/
168
+ describe "list" do
169
+ context "when there is at least one ignored dependency" do
170
+ it "shows the ignored dependencies" do
171
+ expect(config).to receive(:ignore_dependencies).and_return(['bundler'])
172
+ expect(capture_stdout { subject.list }).to match /bundler/
173
+ end
166
174
  end
167
- end
168
175
 
169
- context "when there are no ignored dependencies" do
170
- it "prints '(none)'" do
171
- expect(config).to receive(:ignore_dependencies).and_return([])
172
- expect(capture_stdout { subject.list }).to match /\(none\)/
176
+ context "when there are no ignored dependencies" do
177
+ it "prints '(none)'" do
178
+ expect(config).to receive(:ignore_dependencies).and_return([])
179
+ expect(capture_stdout { subject.list }).to match /\(none\)/
180
+ end
173
181
  end
174
182
  end
175
- end
176
183
 
177
- describe "add" do
178
- it "adds the specified group to the ignored groups list" do
179
- config.ignore_dependencies.should_receive(:push).with("test")
180
- config.should_receive(:save)
181
- expect(DependencyManager).to receive(:sync_with_package_managers)
184
+ describe "add" do
185
+ it "adds the specified group to the ignored groups list" do
186
+ expect(config.ignore_dependencies).to receive(:push).with("test")
187
+ expect(config).to receive(:save)
188
+ expect(dependency_manager).to receive(:sync_with_package_managers)
182
189
 
183
- silence_stdout do
184
- subject.add("test")
190
+ silence_stdout do
191
+ subject.add("test")
192
+ end
185
193
  end
186
194
  end
187
- end
188
195
 
189
- describe "remove" do
190
- it "removes the specified group from the ignored groups list" do
191
- config.ignore_dependencies.should_receive(:delete).with("test")
192
- config.should_receive(:save)
193
- expect(DependencyManager).to receive(:sync_with_package_managers)
196
+ describe "remove" do
197
+ it "removes the specified group from the ignored groups list" do
198
+ expect(config.ignore_dependencies).to receive(:delete).with("test")
199
+ expect(config).to receive(:save)
200
+ expect(dependency_manager).to receive(:sync_with_package_managers)
194
201
 
195
- silence_stdout do
196
- subject.remove("test")
202
+ silence_stdout do
203
+ subject.remove("test")
204
+ end
197
205
  end
198
206
  end
199
207
  end
200
- end
201
208
 
202
- describe Main do
203
- describe "default" do
204
- it "checks for action items" do
205
- DependencyManager.should_receive(:sync_with_package_managers)
206
- Dependency.stub(:unapproved) { [] }
207
- silence_stdout do
208
- described_class.start([])
209
+ describe Main do
210
+ describe "default" do
211
+ it "checks for action items" do
212
+ expect(dependency_manager).to receive(:sync_with_package_managers)
213
+ allow(Dependency).to receive(:unapproved) { [] }
214
+ silence_stdout do
215
+ described_class.start([])
216
+ end
209
217
  end
210
218
  end
211
- end
212
219
 
213
- describe "#rescan" do
214
- it "resyncs with Gemfile" do
215
- DependencyManager.should_receive(:sync_with_package_managers)
216
- Dependency.stub(:unapproved) { [] }
220
+ describe "#rescan" do
221
+ it "resyncs with Gemfile" do
222
+ expect(dependency_manager).to receive(:sync_with_package_managers)
223
+ allow(Dependency).to receive(:unapproved) { [] }
217
224
 
218
- silence_stdout do
219
- subject.rescan
225
+ silence_stdout do
226
+ subject.rescan
227
+ end
220
228
  end
221
229
  end
222
- end
223
230
 
224
- describe "#license" do
225
- it "updates the license on the requested gem" do
226
- DependencyManager.should_receive(:license!).with("foo_gem", "foo")
231
+ describe "#license" do
232
+ it "updates the license on the requested gem" do
233
+ expect(dependency_manager).to receive(:license!).with("foo_gem", "foo")
227
234
 
228
- silence_stdout do
229
- subject.license 'foo', 'foo_gem'
235
+ silence_stdout do
236
+ subject.license 'foo', 'foo_gem'
237
+ end
230
238
  end
231
239
  end
232
- end
233
240
 
234
- describe "#approve" do
235
- it "approves the requested gem" do
236
- DependencyManager.should_receive(:approve!).with("foo", nil, nil)
241
+ describe "#approve" do
242
+ it "approves the requested gem" do
243
+ expect(dependency_manager).to receive(:approve!).with("foo", nil, nil)
237
244
 
238
- silence_stdout do
239
- subject.approve 'foo'
245
+ silence_stdout do
246
+ subject.approve 'foo'
247
+ end
240
248
  end
241
- end
242
249
 
243
- it "approves multiple gem" do
244
- DependencyManager.should_receive(:approve!).with("foo", nil, nil)
245
- DependencyManager.should_receive(:approve!).with("bar", nil, nil)
250
+ it "approves multiple gem" do
251
+ expect(dependency_manager).to receive(:approve!).with("foo", nil, nil)
252
+ expect(dependency_manager).to receive(:approve!).with("bar", nil, nil)
246
253
 
247
- silence_stdout do
248
- subject.approve 'foo', 'bar'
254
+ silence_stdout do
255
+ subject.approve 'foo', 'bar'
256
+ end
249
257
  end
250
- end
251
258
 
252
- it "raises a warning if no gem was specified" do
253
- DependencyManager.should_not_receive(:approve!)
259
+ it "raises a warning if no gem was specified" do
260
+ expect(dependency_manager).not_to receive(:approve!)
254
261
 
255
- silence_stdout do
256
- expect { subject.approve }.to raise_error(ArgumentError)
262
+ silence_stdout do
263
+ expect { subject.approve }.to raise_error(ArgumentError)
264
+ end
257
265
  end
258
- end
259
266
 
260
- it "sets approver and approval message" do
261
- DependencyManager.should_receive(:approve!).with("foo", "Julian", "We really need this")
267
+ it "sets approver and approval message" do
268
+ expect(dependency_manager).to receive(:approve!).with("foo", "Julian", "We really need this")
262
269
 
263
- silence_stdout do
264
- Main.start(["approve", "--approver", "Julian", "--message", "We really need this", "foo"])
270
+ silence_stdout do
271
+ Main.start(["approve", "--approver", "Julian", "--message", "We really need this", "foo"])
272
+ end
265
273
  end
266
274
  end
267
- end
268
275
 
269
- describe "#action_items" do
270
- it "reports unapproved dependencies" do
271
- Dependency.stub(:unapproved) { ['one dependency'] }
272
- TextReport.stub(:new) { double(:report, to_s: "a report!") }
273
- silence_stdout do
274
- subject.stub(:say)
275
- subject.should_receive(:say).with(/dependencies/i, :red)
276
- expect { subject.action_items }.to raise_error(SystemExit)
276
+ describe "#action_items" do
277
+ it "reports unapproved dependencies" do
278
+ allow(Dependency).to receive(:unapproved) { ['one dependency'] }
279
+ allow(TextReport).to receive(:new) { double(:report, to_s: "a report!") }
280
+ silence_stdout do
281
+ allow(subject).to receive(:say)
282
+ expect(subject).to receive(:say).with(/dependencies/i, :red)
283
+ expect { subject.action_items }.to raise_error(SystemExit)
284
+ end
277
285
  end
278
- end
279
286
 
280
- it "reports that all dependencies are approved" do
281
- Dependency.stub(:unapproved) { [] }
282
- silence_stdout do
283
- subject.should_receive(:say).with(/approved/i, :green)
284
- expect { subject.action_items }.to_not raise_error
287
+ it "reports that all dependencies are approved" do
288
+ allow(Dependency).to receive(:unapproved) { [] }
289
+ silence_stdout do
290
+ expect(subject).to receive(:say).with(/approved/i, :green)
291
+ expect { subject.action_items }.to_not raise_error
292
+ end
285
293
  end
286
294
  end
287
295
  end