Sha256: 18b16cbfdc17e6bfcc4c3390e95e848ffa8cdffee0047123994bc427fe4144dc

Contents?: true

Size: 1.2 KB

Versions: 9

Compression:

Stored size: 1.2 KB

Contents

require "spec_helper"

RSpec.describe "Certificate Duplication" do
  describe "duplicate an existing certificate", api_call: true do
    it "duplicates an existing nonexpired certificate order" do
      duplication = Digicert::OrderDuplicator.create(order_id: recent_order.id)
      duplicate_certificate = Digicert::DuplicateCertificateFinder.find_by(
        request_id: duplication.requests.first.id,
      )

      expect(
        order.duplicate_certificates.map(&:id),
      ).to include(duplicate_certificate.id)
    end
  end

  # Create a order class instance
  #
  # This helper create an instance for the order, so we can invoke the
  # order's instance method to access the duplicate certificates
  #
  def order
    @order ||= Digicert::Order.find(recent_order.id)
  end

  # Recent order
  #
  # All of the certifacate are not duplicable, from the test we can say
  # for sure that the wilcard certifacate are duplicable. This spec assume
  # the last order to be a ssl wildcard, if it fails then please run the
  # `order_ssl_wildcard` request specs to create one and then re-run this
  # spec again.
  #
  def recent_order
    @recent_order ||= orders.first
  end

  def orders
    Digicert::Order.all
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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