summaryrefslogtreecommitdiff
path: root/spec/integration/cli
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
parentb10053c7c14c3312f79a6d476b676d0d647d66cb (diff)
Extract core namespace
Diffstat (limited to 'spec/integration/cli')
-rw-r--r--spec/integration/cli/index/build_spec.rb19
-rw-r--r--spec/integration/cli/index/update_spec.rb18
-rw-r--r--spec/integration/cli/index_spec.rb16
-rw-r--r--spec/integration/cli/scan_spec.rb78
4 files changed, 131 insertions, 0 deletions
diff --git a/spec/integration/cli/index/build_spec.rb b/spec/integration/cli/index/build_spec.rb
new file mode 100644
index 0000000..b48239a
--- /dev/null
+++ b/spec/integration/cli/index/build_spec.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+RSpec.describe '`spandx index build` command', type: :cli do
+ it 'executes `spandx index help build` command successfully' do
+ output = `spandx index help build`
+ expected_output = <<~OUT
+ Usage:
+ spandx index build
+
+ Options:
+ -h, [--help], [--no-help] # Display usage information
+ -d, [--directory=DIRECTORY] # Directory to build index in
+ # Default: .index
+
+ Build a package index
+ OUT
+ expect(output).to eq(expected_output)
+ end
+end
diff --git a/spec/integration/cli/index/update_spec.rb b/spec/integration/cli/index/update_spec.rb
new file mode 100644
index 0000000..9ee0b7e
--- /dev/null
+++ b/spec/integration/cli/index/update_spec.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+RSpec.describe '`spandx index update` command', type: :cli do
+ it 'executes `spandx index help update` command successfully' do
+ output = `spandx index help update`
+ expected_output = <<~OUT
+ Usage:
+ spandx index update
+
+ Options:
+ -h, [--help], [--no-help] # Display usage information
+
+ Update the offline indexes
+ OUT
+
+ expect(output).to eq(expected_output)
+ end
+end
diff --git a/spec/integration/cli/index_spec.rb b/spec/integration/cli/index_spec.rb
new file mode 100644
index 0000000..6b3c783
--- /dev/null
+++ b/spec/integration/cli/index_spec.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+RSpec.describe '`spandx index` command', type: :cli do
+ it 'executes `spandx help index` command successfully' do
+ output = `spandx help index`
+ expected_output = <<~OUT
+ Commands:
+ spandx index build # Build a package index
+ spandx index help [COMMAND] # Describe subcommands or one specific subcommand
+ spandx index update # Update the offline indexes
+
+ OUT
+
+ expect(output).to eq(expected_output)
+ end
+end
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