summaryrefslogtreecommitdiff
path: root/spec/integration/cli/scan_spec.rb
blob: 51d539f95afffb38db3218cc7c7bb16bd98e9666 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# frozen_string_literal: true

RSpec.describe '`spandx scan` command', type: :cli do
  it 'executes `spandx help scan` command successfully' do
    output = `spandx help scan`
    expect(output).to eq(fixture_file_content('help-scan.expected'))
  end

  it 'executes `spandx scan Gemfile.lock`' do
    output = `spandx scan #{fixture_file('bundler/Gemfile.lock')} 2> /dev/null`
    expect(output).to eq(fixture_file_content('bundler/Gemfile.lock.expected'))
  end

  it 'executes `spandx scan gems.lock' do
    output = `spandx scan #{fixture_file('bundler/gems.lock')} 2> /dev/null`
    expect(output).to eq(fixture_file_content('bundler/gems.lock.expected'))
  end

  it 'executes `spandx scan Pipfile.lock`' do
    output = `spandx scan #{fixture_file('pip/Pipfile.lock')} 2> /dev/null`
    expect(output).to eq(fixture_file_content('pip/Pipfile.lock.expected'))
  end

  it 'executes `spandx scan yarnfile.lock`' do
    output = `spandx scan #{fixture_file('js/yarn.lock')} 2> /dev/null`
    expect(output).to eq(fixture_file_content('js/yarn.lock.expected'))
  end

  it 'executes `spandx scan composer.lock`' do
    output = `spandx scan #{fixture_file('composer/composer.lock')} 2> /dev/null`
    expect(output).to eq(fixture_file_content('composer/composer.lock.expected'))
  end

  it 'executes `spandx scan /lib/apk/db/installed' do
    output = `spandx scan #{fixture_file('os/lib/apk/db/installed')} 2> /dev/null`
    expect(output).to eq(fixture_file_content('os/lib/apk/db/installed.expected'))
  end

  it 'executes `spandx scan /var/lib/dpkg/status' do
    output = `spandx scan #{fixture_file('os/var/lib/dpkg/status')} 2> /dev/null`
    expect(output).to eq(fixture_file_content('os/var/lib/dpkg/status.expected'))
  end

  it 'executes `spandx scan .terraform.lock.hcl' do
    output = `spandx scan #{fixture_file('terraform/simple/.terraform.lock.hcl')} 2> /dev/null`
    expect(output).to eq(fixture_file_content('terraform/simple/.terraform.lock.hcl.expected'))
  end
end