diff options
| author | mo khan <mo@mokhan.ca> | 2021-12-15 14:49:27 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2021-12-15 14:49:27 -0700 |
| commit | 5fa7f8345aaff77e19f6081184ea8ab34769f467 (patch) | |
| tree | 28a3e21b7497225baad4cc37fe2b4edd4ae58896 /spec | |
| parent | b47f94f0bfad59cb40f97ee7f518729804285c64 (diff) | |
fix: fallback to latest version
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/unit/spdx/catalogue_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/unit/spdx/catalogue_spec.rb b/spec/unit/spdx/catalogue_spec.rb index efbe8ab..eeab29a 100644 --- a/spec/unit/spdx/catalogue_spec.rb +++ b/spec/unit/spdx/catalogue_spec.rb @@ -97,4 +97,25 @@ RSpec.describe Spandx::Spdx::Catalogue do it { expect(subject.count).to be > 400 } end + + describe '.default' do + subject { described_class.default } + + context 'when the SPDX catalogue has not been cloned' do + let(:gateway) { instance_double(Spandx::Spdx::Gateway, fetch: catalogue) } + let(:catalogue) { { licenses: [{ licenseId: 'example' }] } } + + before do + allow(Spandx::Spdx::Gateway).to receive(:new).and_return(gateway) + allow(Spandx.git[:spdx]).to receive(:read).and_return(nil) + end + + it { expect { subject }.not_to raise_error } + it { expect(subject.count).to be(1) } + end + + context 'when the SPDX catalogue has been cloned' do + it { expect(subject.count).to be > 400 } + end + end end |
