diff options
| author | mo khan <mo.khan@gmail.com> | 2020-03-03 12:04:56 -0700 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-03-03 12:04:56 -0700 |
| commit | c40d6e4c275111814933fc575cb697620c065589 (patch) | |
| tree | 874595929857e13784281710a32e7dcd97a163a9 /spec/unit/dotnet | |
| parent | 741e07e6c9e8673659c5dfbbf4972a5bf007d004 (diff) | |
Update build subcommand to delegate to Index
Diffstat (limited to 'spec/unit/dotnet')
| -rw-r--r-- | spec/unit/dotnet/index_spec.rb | 15 | ||||
| -rw-r--r-- | spec/unit/dotnet/nuget_gateway_spec.rb | 14 | ||||
| -rw-r--r-- | spec/unit/dotnet/parsers/csproj_spec.rb | 2 | ||||
| -rw-r--r-- | spec/unit/dotnet/parsers/packages_config_spec.rb | 2 | ||||
| -rw-r--r-- | spec/unit/dotnet/parsers/sln_spec.rb | 2 |
5 files changed, 19 insertions, 16 deletions
diff --git a/spec/unit/dotnet/index_spec.rb b/spec/unit/dotnet/index_spec.rb index 9d1fc55..6686deb 100644 --- a/spec/unit/dotnet/index_spec.rb +++ b/spec/unit/dotnet/index_spec.rb @@ -30,4 +30,19 @@ RSpec.describe Spandx::Dotnet::Index do specify { expect(subject).to be_indexed(key) } end + + describe '#update!' do + let(:catalogue) { Spandx::Spdx::Catalogue.from_file(fixture_file('spdx/json/licenses.json')) } + let(:gateway) { instance_double(Spandx::Dotnet::NugetGateway, host: 'api.nuget.org') } + + before do + allow(Spandx::Dotnet::NugetGateway).to receive(:new).and_return(gateway) + allow(gateway).to receive(:each) + .and_yield({ 'id' => 'Polaroider', 'version' => '0.2.0', 'licenseExpression' => 'MIT'}) + + subject.update!(catalogue: catalogue, limit: 10) + end + + specify { expect(subject.read(['api.nuget.org', 'Polaroider', '0.2.0'])).to eql('MIT') } + end end diff --git a/spec/unit/dotnet/nuget_gateway_spec.rb b/spec/unit/dotnet/nuget_gateway_spec.rb index 4b359d3..aab9cc0 100644 --- a/spec/unit/dotnet/nuget_gateway_spec.rb +++ b/spec/unit/dotnet/nuget_gateway_spec.rb @@ -3,7 +3,7 @@ RSpec.describe Spandx::Dotnet::NugetGateway do subject { described_class.new(catalogue: catalogue) } - let(:catalogue) { Spandx::Catalogue.from_file(fixture_file('spdx/json/licenses.json')) } + let(:catalogue) { Spandx::Spdx::Catalogue.from_file(fixture_file('spdx/json/licenses.json')) } describe '#licenses_for' do context 'when the package specifies the license using an expression' do @@ -17,16 +17,4 @@ RSpec.describe Spandx::Dotnet::NugetGateway do pending 'when the package specifies the license using a file' pending 'when the package specifies the license using a url' end - - describe '#update!' do - let(:index) { instance_double(Spandx::Dotnet::Index, write: nil) } - - before do - VCR.use_cassette('nuget-catalogue') do - subject.update!(index, limit: 10) - end - end - - it { expect(index).to have_received(:write).with(['api.nuget.org', 'Polaroider', '0.2.0'], 'MIT') } - end end diff --git a/spec/unit/dotnet/parsers/csproj_spec.rb b/spec/unit/dotnet/parsers/csproj_spec.rb index a913ed7..eb6aca0 100644 --- a/spec/unit/dotnet/parsers/csproj_spec.rb +++ b/spec/unit/dotnet/parsers/csproj_spec.rb @@ -3,7 +3,7 @@ RSpec.describe Spandx::Dotnet::Parsers::Csproj do subject { described_class.new(catalogue: catalogue) } - let(:catalogue) { Spandx::Catalogue.from_file(fixture_file('spdx/json/licenses.json')) } + let(:catalogue) { Spandx::Spdx::Catalogue.from_file(fixture_file('spdx/json/licenses.json')) } describe '#parse' do context 'when parsing a .csproj file' do diff --git a/spec/unit/dotnet/parsers/packages_config_spec.rb b/spec/unit/dotnet/parsers/packages_config_spec.rb index b9763cc..cdf885c 100644 --- a/spec/unit/dotnet/parsers/packages_config_spec.rb +++ b/spec/unit/dotnet/parsers/packages_config_spec.rb @@ -3,7 +3,7 @@ RSpec.describe Spandx::Dotnet::Parsers::PackagesConfig do subject { described_class.new(catalogue: catalogue) } - let(:catalogue) { Spandx::Catalogue.from_file(fixture_file('spdx/json/licenses.json')) } + let(:catalogue) { Spandx::Spdx::Catalogue.from_file(fixture_file('spdx/json/licenses.json')) } describe '#parse' do context 'when parsing a Gemfile with a single dependency' do diff --git a/spec/unit/dotnet/parsers/sln_spec.rb b/spec/unit/dotnet/parsers/sln_spec.rb index 6051dbe..d9b306b 100644 --- a/spec/unit/dotnet/parsers/sln_spec.rb +++ b/spec/unit/dotnet/parsers/sln_spec.rb @@ -3,7 +3,7 @@ RSpec.describe Spandx::Dotnet::Parsers::Sln do subject { described_class.new(catalogue: catalogue) } - let(:catalogue) { Spandx::Catalogue.from_file(fixture_file('spdx/json/licenses.json')) } + let(:catalogue) { Spandx::Spdx::Catalogue.from_file(fixture_file('spdx/json/licenses.json')) } describe '#parse' do context 'when parsing a sln file without any project references' do |
