diff options
| author | mo khan <mo.khan@gmail.com> | 2020-05-22 09:28:44 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-05-25 18:31:06 -0600 |
| commit | 1ca2a951d05480759af1668ed586793ff5d36a26 (patch) | |
| tree | ca16267ec26b1d8c3b1a1346a1ab9e8689992116 /spec/integration/cli | |
| parent | f8092c7f0ad26d04c8137b3b7d4faea5508a53ce (diff) | |
Convert from using string paths to using Pathname
* Extract a ./bin/run script
* Extract defintion for NEWLINE
* Add specs for matching yarn.lock
* Add specs for Report
* Convert package_manager to pathname
* Display path in report
* matches? to match?
Diffstat (limited to 'spec/integration/cli')
| -rw-r--r-- | spec/integration/cli/scan_spec.rb | 88 |
1 files changed, 10 insertions, 78 deletions
diff --git a/spec/integration/cli/scan_spec.rb b/spec/integration/cli/scan_spec.rb index 0ca9e6d..c92ea29 100644 --- a/spec/integration/cli/scan_spec.rb +++ b/spec/integration/cli/scan_spec.rb @@ -3,99 +3,31 @@ RSpec.describe '`spandx scan` command', type: :cli do it 'executes `spandx help scan` command successfully' do output = `spandx help scan` - expected_output = <<~OUT - Usage: - spandx scan LOCKFILE - - Options: - -h, [--help], [--no-help] # Display usage information - -R, [--recursive], [--no-recursive] # Perform recursive scan - -a, [--airgap], [--no-airgap] # Disable network connections - -l, [--logfile=LOGFILE] # Path to a logfile - # Default: /dev/null - -f, [--format=FORMAT] # Format of report. (table, csv, json, hash) - # Default: table - -p, [--pull], [--no-pull] # Pull the latest cache before the scan - -r, [--require=REQUIRE] # Causes spandx to load the library using require. - -sp, [--show-progress], [--no-show-progress] # Shows a progress bar - # Default: true - - Scan a lockfile and list dependencies/licenses - OUT - - expect(output).to eq(expected_output) + expect(output).to eq(fixture_file_content('help-scan.expected')) end it 'executes `spandx scan Gemfile.lock`' do - gemfile_lock = fixture_file('bundler/Gemfile.lock') - output = `spandx scan #{gemfile_lock} --format=json --no-show-progress` - expected_output = <<~OUT - { - "version": "1.0", - "dependencies": [ - { - "name": "net-hippie", - "version": "0.2.7", - "licenses": [ - "MIT" - ] - } - ] - } - OUT - expect(output).to eq(expected_output) + output = `spandx scan #{fixture_file('bundler/Gemfile.lock')} --no-show-progress` + expect(output).to eq(fixture_file_content('bundler/Gemfile.lock.expected')) end it 'executes `spandx scan gems.lock' do - gemfile_lock = fixture_file('bundler/gems.lock') - output = `spandx scan #{gemfile_lock} --format=json --no-show-progress` - expected_output = <<~OUT - { - "version": "1.0", - "dependencies": [ - { - "name": "net-hippie", - "version": "0.2.7", - "licenses": [ - "MIT" - ] - } - ] - } - OUT - expect(output).to eq(expected_output) + output = `spandx scan #{fixture_file('bundler/gems.lock')} --no-show-progress` + expect(output).to eq(fixture_file_content('bundler/gems.lock.expected')) end it 'executes `spandx scan Pipfile.lock`' do - lockfile = fixture_file('pip/Pipfile.lock') - output = `spandx scan #{lockfile} --format=json --no-show-progress` - expected_output = <<~OUT - { - "version": "1.0", - "dependencies": [ - { - "name": "six", - "version": "1.13.0", - "licenses": [ - "MIT" - ] - } - ] - } - OUT - expect(output).to eq(expected_output) + output = `spandx scan #{fixture_file('pip/Pipfile.lock')} --no-show-progress` + expect(output).to eq(fixture_file_content('pip/Pipfile.lock.expected')) end - xit 'executes `spandx scan yarnfile.lock`' do - lockfile = fixture_file('js/yarn.lock') - output = `spandx scan #{lockfile} --no-show-progress` + it 'executes `spandx scan yarnfile.lock`' do + output = `spandx scan #{fixture_file('js/yarn.lock')} --no-show-progress` expect(output).to eq(fixture_file_content('js/yarn.lock.expected')) end it 'executes `spandx scan composer.lock`' do - lockfile = fixture_file('composer/composer.lock') - output = `spandx scan #{lockfile} --no-show-progress` - + output = `spandx scan #{fixture_file('composer/composer.lock')} --no-show-progress` expect(output).to eq(fixture_file_content('composer/composer.lock.expected')) end end |
