Sha256: 373390fceba50e17aacc8e40fd1d4c39965680053e27633edbc407377965b2c9

Contents?: true

Size: 810 Bytes

Versions: 7

Compression:

Stored size: 810 Bytes

Contents

require "spec_helper"
require "digicert/cli/certificate_downloader"

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

7 entries across 7 versions & 1 rubygems

Version Path
digicert-cli-0.5.1 spec/digicert/cli/certificate_downloader_spec.rb
digicert-cli-0.5.0 spec/digicert/cli/certificate_downloader_spec.rb
digicert-cli-0.4.2 spec/digicert/cli/certificate_downloader_spec.rb
digicert-cli-0.4.1 spec/digicert/cli/certificate_downloader_spec.rb
digicert-cli-0.4.0 spec/digicert/cli/certificate_downloader_spec.rb
digicert-cli-0.3.0 spec/digicert/cli/certificate_downloader_spec.rb
digicert-cli-0.2.0 spec/digicert/cli/certificate_downloader_spec.rb