summaryrefslogtreecommitdiff
path: root/spec/integration/dependabot/cli_spec.rb
blob: b27a1f122e4b0cf4d1a4ea8f0d636df619f4b0e7 (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
# frozen_string_literal: true

RSpec.describe Dependabot::CLI, type: :cli do
  it { expect(`./exe/dependabot help scan`).to eq(fixture_file_content("help-scan.expected")) }
  pending { expect(`./exe/dependabot help`).to eq(fixture_file_content("help.expected")) }

  describe Dependabot::CLI::Scan do
    subject!(:dependabot) { File.join(Dir.pwd, "exe/dependabot") }

    context "when scanning a bundler v1 project" do
      specify do
        within_tmp_dir do |path|
          system "git clone --quiet https://github.com/dependanot/examples ."
          system "#{dependabot} scan #{path}/src/bundler/v1/"
          expect(`git branch | grep dependanot | wc -l`.chomp.to_i).to be > 35
        end
      end
    end

    context "when scanning a bundler v2 project" do
      specify do
        within_tmp_dir do |path|
          system "git clone --quiet https://github.com/dependanot/examples ."
          system "#{dependabot} scan #{path}/src/bundler/v2/"
          expect(`git branch | grep dependanot | wc -l`.chomp.to_i).to be > 40
        end
      end
    end

    context "when scanning an npm project" do
      specify do
        within_tmp_dir do |path|
          system "git clone --quiet https://github.com/dependanot/examples ."
          system "#{dependabot} scan #{path}/src/npm/"
          expect(`git branch | grep dependanot | wc -l`.chomp.to_i).to eq(1)
        end
      end
    end
  end
end