Sha256: e93f36b04904fade7ee2711330dff1553f942997664818ef3676c1bc4b08d7e7

Contents?: true

Size: 1.8 KB

Versions: 5

Compression:

Stored size: 1.8 KB

Contents

require "spec_helper"

RSpec.describe "Certificate" do
  describe "fetch a certificate" do
    it "returns certificate details for an order" do
      command = %w(certificate fetch 123456 --quiet)
      allow(certificate_klass).to receive_message_chain(:new, :fetch)

      Digicert::CLI.start(command)

      expect(certificate_klass.new).to have_received(:fetch)
      expect(certificate_klass).to have_received(:new).with(
        order_id: "123456", quiet: true,
      )
    end
  end

  describe "downloading a certificate" do
    it "downloads the certificate to provided path" do
      command = %w(certificate fetch 123456 --output /tmp/downloads)
      allow(Digicert::CLI::Certificate).to receive_message_chain(:new, :fetch)

      Digicert::CLI.start(command)

      expect(Digicert::CLI::Certificate).to have_received(:new).with(
        order_id: "123456", output: "/tmp/downloads"
      )
    end
  end

  describe "listing duplicate certificates" do
    it "returns the list of duplicate certificates" do
      command = %w(certificate duplicates 123456)

      allow(
        Digicert::CLI::Certificate,
      ).to receive_message_chain(:new, :duplicates)

      Digicert::CLI.start(command)

      expect(
        Digicert::CLI::Certificate,
      ).to have_received(:new).with(order_id: "123456")
    end
  end

  describe "downloading a certificate" do
    it "downloads the certificate to output path" do
      command = %w(certificate download --certificate_id 123 --output /tmp)

      allow(
        Digicert::CLI::Certificate,
      ).to receive_message_chain(:new, :download)

      Digicert::CLI.start(command)

      expect(
        Digicert::CLI::Certificate,
      ).to have_received(:new).with(certificate_id: "123", output: "/tmp")
    end
  end

  def certificate_klass
    Digicert::CLI::Certificate
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
digicert-cli-0.4.2 spec/acceptance/certificate_spec.rb
digicert-cli-0.4.1 spec/acceptance/certificate_spec.rb
digicert-cli-0.4.0 spec/acceptance/certificate_spec.rb
digicert-cli-0.3.0 spec/acceptance/certificate_spec.rb
digicert-cli-0.2.0 spec/acceptance/certificate_spec.rb