summaryrefslogtreecommitdiff
path: root/spec/integration/cli/scan_spec.rb
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-03-03 10:58:47 -0700
committermo khan <mo.khan@gmail.com>2020-03-03 10:58:47 -0700
commit28881febd40ecb5c0b771c307b9624689c4e0973 (patch)
tree236e94055ae78f3d53c4052c8cbe4c96c4629aa7 /spec/integration/cli/scan_spec.rb
parentb10053c7c14c3312f79a6d476b676d0d647d66cb (diff)
Extract core namespace
Diffstat (limited to 'spec/integration/cli/scan_spec.rb')
-rw-r--r--spec/integration/cli/scan_spec.rb78
1 files changed, 78 insertions, 0 deletions
diff --git a/spec/integration/cli/scan_spec.rb b/spec/integration/cli/scan_spec.rb
new file mode 100644
index 0000000..8b8b610
--- /dev/null
+++ b/spec/integration/cli/scan_spec.rb
@@ -0,0 +1,78 @@
+# frozen_string_literal: true
+
+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
+
+ Scan a lockfile and list dependencies/licenses
+ OUT
+
+ expect(output).to eq(expected_output)
+ end
+
+ it 'executes `spandx scan Gemfile.lock`' do
+ gemfile_lock = fixture_file('bundler/Gemfile.lock')
+ output = `spandx scan #{gemfile_lock}`
+ expected_output = <<~OUT
+ {
+ "version": "1.0",
+ "packages": [
+ {
+ "name": "net-hippie",
+ "version": "0.2.7",
+ "licenses": [
+ "MIT"
+ ]
+ }
+ ]
+ }
+ OUT
+ expect(output).to eq(expected_output)
+ end
+
+ it 'executes `spandx scan gems.lock' do
+ gemfile_lock = fixture_file('bundler/gems.lock')
+ output = `spandx scan #{gemfile_lock}`
+ expected_output = <<~OUT
+ {
+ "version": "1.0",
+ "packages": [
+ {
+ "name": "net-hippie",
+ "version": "0.2.7",
+ "licenses": [
+ "MIT"
+ ]
+ }
+ ]
+ }
+ OUT
+ expect(output).to eq(expected_output)
+ end
+
+ it 'executes `spandx scan Pipfile.lock`' do
+ lockfile = fixture_file('pip/Pipfile.lock')
+ output = `spandx scan #{lockfile}`
+ expected_output = <<~OUT
+ {
+ "version": "1.0",
+ "packages": [
+ {
+ "name": "six",
+ "version": "1.13.0",
+ "licenses": [
+ "MIT"
+ ]
+ }
+ ]
+ }
+ OUT
+ expect(output).to eq(expected_output)
+ end
+end