summaryrefslogtreecommitdiff
path: root/spec/integration/core
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-05-01 11:49:31 -0600
committermo khan <mo.khan@gmail.com>2020-05-01 11:49:31 -0600
commitb42ee0bd6e67b8a9dff90891327ceba426b0190c (patch)
treeae00d9371d54a0665cb7934e0ffb83db632dbd10 /spec/integration/core
parent896026c1720f9f5fd12314ff67e824ef51d4ffef (diff)
Update nuget cache builder to delegate to cache class
Diffstat (limited to 'spec/integration/core')
-rw-r--r--spec/integration/core/cache_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/integration/core/cache_spec.rb b/spec/integration/core/cache_spec.rb
index 6896134..116f3bb 100644
--- a/spec/integration/core/cache_spec.rb
+++ b/spec/integration/core/cache_spec.rb
@@ -46,6 +46,30 @@ RSpec.describe Spandx::Core::Cache do
specify { expect(subject.licenses_for(dependency_name, version)).to match_array(['MIT']) }
end
+
+ context "when attempting to insert invalid entries" do
+ specify do
+ subject.insert(nil, '1.1.1', ['MIT'])
+ expect(subject.licenses_for(nil, '1.1.1')).to be_empty
+ end
+
+ specify do
+ subject.insert('', '1.1.1', ['MIT'])
+ expect(subject.licenses_for('', '1.1.1')).to be_empty
+ end
+
+ specify do
+ subject.insert('spandx', nil, ['MIT'])
+ expect(subject.licenses_for(nil, '1.1.1')).to be_empty
+ expect(File.exist?(File.join(root_dir, 'cf'))).to be(false)
+ end
+
+ specify do
+ subject.insert('spandx', '', ['MIT'])
+ expect(subject.licenses_for('', '1.1.1')).to be_empty
+ expect(File.exist?(File.join(root_dir, 'cf'))).to be(false)
+ end
+ end
end
describe "#rebuild_index" do