summaryrefslogtreecommitdiff
path: root/spec/unit/dotnet
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-04-19 22:21:34 -0600
committermo khan <mo.khan@gmail.com>2020-04-19 22:21:34 -0600
commit9cbad86761dab4f1c7cf33efcf56628c912e08c6 (patch)
treeeeebbb526d53924d22d3afb3dbe9e197562a2b89 /spec/unit/dotnet
parent39c7f3396e99ef79ddf994249b8f2657ca67481d (diff)
Collapse file storage code into Cache class
Diffstat (limited to 'spec/unit/dotnet')
-rw-r--r--spec/unit/dotnet/index_spec.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/spec/unit/dotnet/index_spec.rb b/spec/unit/dotnet/index_spec.rb
index da5e3b9..2550e35 100644
--- a/spec/unit/dotnet/index_spec.rb
+++ b/spec/unit/dotnet/index_spec.rb
@@ -1,8 +1,9 @@
# frozen_string_literal: true
RSpec.describe Spandx::Dotnet::Index do
- subject { described_class.new(directory: directory) }
+ subject { described_class.new(directory: directory, gateway: gateway) }
+ let(:gateway) { instance_double(Spandx::Dotnet::NugetGateway) }
let(:directory) { Dir.mktmpdir('spandx') }
after do
@@ -10,17 +11,14 @@ RSpec.describe Spandx::Dotnet::Index do
end
describe '#update!' do
- let(:catalogue) { Spandx::Spdx::Catalogue.from_file(fixture_file('spdx/json/licenses.json')) }
- let(:gateway) { instance_double(Spandx::Dotnet::NugetGateway) }
+ let(:item) { { 'id' => 'Polaroider', 'version' => '0.2.0', 'licenseExpression' => 'MIT' } }
before do
- allow(Spandx::Dotnet::NugetGateway).to receive(:new).and_return(gateway)
- item = { 'id' => 'Polaroider', 'version' => '0.2.0', 'licenseExpression' => 'MIT' }
- allow(gateway).to receive(:each).and_yield(item, 0)
+ allow(gateway).to receive(:each).and_yield(item)
- subject.update!(catalogue: catalogue)
+ subject.update!(db: db)
end
- specify { expect(subject.licenses_for(name: 'Polaroider', version: '0.2.0')).to match_array(['MIT']) }
+ specify { expect(db.licenses_for('Polaroider', '0.2.0')).to match_array(['MIT']) }
end
end