Sha256: a050b5d60b11ab090c6e81c0f307a0a39a988c15eb8f8dc277a0c015ef88686f

Contents?: true

Size: 764 Bytes

Versions: 2

Compression:

Stored size: 764 Bytes

Contents

require "spec_helper"

RSpec.describe Digicert::CLI::CertificateDownloader do
  describe ".download" do
    it "downloads the certificate to the specified path" do
      certificate_id = 123_456_789
      allow(File).to receive(:open)
      mock_digicert_certificate_download_api(certificate_id)

      Digicert::CLI::CertificateDownloader.download(
        print_enable: false,
        path: download_path,
        certificate_id: certificate_id,
      )

      expect(File).to have_received(:open).thrice
    end
  end

  def download_path
    File.expand_path("../../tmp", __FILE__).to_s
  end

  def mock_digicert_certificate_download_api(certificate_id)
    stub_digicert_certificate_download_by_format(
      certificate_id, "pem_all", "pem"
    )
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
digicert-cli-1.0.0 spec/digicert/cli/certificate_downloader_spec.rb
digicert-cli-0.5.2 spec/digicert/cli/certificate_downloader_spec.rb