diff options
| author | mo khan <mo.khan@gmail.com> | 2020-05-08 09:33:15 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-05-08 09:33:15 -0600 |
| commit | 1b111dde18fe7eed677a72136ed54544aede6de5 (patch) | |
| tree | 5dc55e470bbd18bd9b82434e224bff2c66df29aa /spec/integration | |
| parent | 7991a87db0ed754d90a276384e74691ebfa138c3 (diff) | |
Allow traversal of entries in the index
Diffstat (limited to 'spec/integration')
| -rw-r--r-- | spec/integration/cli/scan_spec.rb | 2 | ||||
| -rw-r--r-- | spec/integration/core/cache_spec.rb | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/spec/integration/cli/scan_spec.rb b/spec/integration/cli/scan_spec.rb index 0e336e4..c30e9ab 100644 --- a/spec/integration/cli/scan_spec.rb +++ b/spec/integration/cli/scan_spec.rb @@ -84,7 +84,7 @@ RSpec.describe '`spandx scan` command', type: :cli do expect(output).to eq(expected_output) end - pending 'executes `spandx scan yarnfile.lock`' do + xit 'executes `spandx scan yarnfile.lock`' do output = `spandx scan #{fixture_file('js/yarn.lock')}` expect(output).to eq(fixture_file_content('js/yarn.lock.expected')) end diff --git a/spec/integration/core/cache_spec.rb b/spec/integration/core/cache_spec.rb index d2edb11..941dea5 100644 --- a/spec/integration/core/cache_spec.rb +++ b/spec/integration/core/cache_spec.rb @@ -126,4 +126,30 @@ RSpec.describe Spandx::Core::Cache do # rubocop:enable RSpec/MultipleExpectations end end + + describe '#each' do + subject { described_class.new('rubygems', root: root_dir) } + + let(:root_dir) { Dir.mktmpdir } + + after do + FileUtils.remove_entry(root_dir) + end + + context 'when a single item is present in the cache' do + before do + subject.insert('spandx', '0.0.0', ['MIT']) + end + + it 'yields each item in the index' do + collect = [] + + subject.each do |item| + collect << item + end + + expect(collect).to match_array([['spandx', '0.0.0', 'MIT']]) + end + end + end end |
