summaryrefslogtreecommitdiff
path: root/spec/unit/cli/build_spec.rb
blob: 2706cb153402838d3b29f6290bf602ed976b75f0 (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
# frozen_string_literal: true

RSpec.describe Spandx::Cli::Commands::Build do
  subject { described_class.new(options) }

  let(:options) { {} }

  describe '#execute' do
    let(:output) { StringIO.new }

    it 'executes `build` command successfully' do
      stub_request(:get, 'https://api.nuget.org/v3/catalog0/index.json')
        .to_return(status: 200, body: JSON.generate(items: []))

      stub_request(:get, 'https://repo.maven.apache.org/maven2/.index/')
        .to_return(status: 200, body: '<html></html>')

      stub_request(:get, 'https://pypi.org/simple/')
        .to_return(status: 200, body: '<html></html>')

      subject.execute(output: output)
      expect(output.string).to eq("maven\nnuget\npypi\nOK\n")
    end
  end
end