Sha256: acabc8db25dd3ec339aaa7315f7bb7ea87a0920d8996d6b83952d73e24c3a865

Contents?: true

Size: 1.26 KB

Versions: 8

Compression:

Stored size: 1.26 KB

Contents

require "spec_helper"

RSpec.describe "Reissuing Certificate" do
  describe "reissue" do
    it "reissues an existing nonexpired certificate", api_call: true do
      # This tests will find the last created certificate order and
      # then will try to reissue that, but one important thing to note
      # that digicert only allows expects active certificate to reissue
      # and normally every certificate in test environment gets expired
      # in 3 days.
      #
      # So, if this fails, then please to run the certificate generation
      # test first, which will create a new order and then try this agian
      # and it should work like a charm
      #
      reissue = Digicert::OrderReissuer.create(order_id: recent_order.id)

      # Let's fetch the details for the new request and that way we can
      # verify that this reissues has the proper request type and then
      # we can do the further tasks on it.
      #
      request_id = reissue.requests.first.id
      certificate_request = Digicert::CertificateRequest.fetch(request_id)

      expect(reissue.id).to eq(recent_order.id)
      expect(certificate_request.type).to eq("reissue")
    end
  end

  def recent_order
    @recent_order ||= orders.first
  end

  def orders
    @orders ||= Digicert::Order.all
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
digicert-1.0.0 spec/requests/certificate_reissuing_spec.rb
digicert-0.5.0 spec/requests/certificate_reissuing_spec.rb
digicert-0.4.1 spec/requests/certificate_reissuing_spec.rb
digicert-0.4.0 spec/requests/certificate_reissuing_spec.rb
digicert-0.3.1 spec/requests/certificate_reissuing_spec.rb
digicert-0.3.0 spec/requests/certificate_reissuing_spec.rb
digicert-0.2.0 spec/requests/certificate_reissuing_spec.rb
digicert-0.1.2 spec/requests/certificate_reissuing_spec.rb