summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2021-12-15 14:49:27 -0700
committermo khan <mo@mokhan.ca>2021-12-15 14:49:27 -0700
commit5fa7f8345aaff77e19f6081184ea8ab34769f467 (patch)
tree28a3e21b7497225baad4cc37fe2b4edd4ae58896 /spec
parentb47f94f0bfad59cb40f97ee7f518729804285c64 (diff)
fix: fallback to latest version
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/spdx/catalogue_spec.rb21
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