Sha256: 29908c0e765a480779037725c71d9d7057fb4a1a06254893858723729c46568a

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

require "spec_helper"

RSpec.describe "Order reissuing" do
  describe "reissue an order" do
    context "reissue with new csr" do
      it "reissues an order with the provided csr" do
        mock_digicert_order_reissuer_create_message_chain
        command = %w(order reissue 123456 --csr ./spec/fixtures/rsa4096.csr)

        _output = capture_stdout { Digicert::CLI.start(command) }

        expect(Digicert::CLI::OrderReissuer).to have_received(:new).
          with(order_id: "123456", csr: "./spec/fixtures/rsa4096.csr")
      end
    end

    context "reissue and download certificate" do
      it "reissues an order and download the certificate" do
        mock_digicert_order_reissuer_create_message_chain
        command = %w(order reissue 123456 --output /tmp/downloads)

        _output = capture_stdout { Digicert::CLI.start(command) }

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

  def mock_digicert_order_reissuer_create_message_chain
    allow(Digicert::CLI::OrderReissuer).to receive_message_chain(:new, :create)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
digicert-cli-1.0.0 spec/acceptance/reissuing_order_spec.rb
digicert-cli-0.5.2 spec/acceptance/reissuing_order_spec.rb
digicert-cli-0.5.1 spec/acceptance/reissuing_order_spec.rb
digicert-cli-0.5.0 spec/acceptance/reissuing_order_spec.rb