Sha256: 6e99b9234e22cf30364902c20ec6eedab6a92c4c81b7bc144e0367271b1597bc

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

require "spec_helper"

RSpec.describe Digicert::Container do
  describe ".all" do
    it "retrieves the list of containers" do
      stub_digicert_container_list_api
      containers = Digicert::Container.all

      expect(containers.first.id).not_to be_nil
      expect(containers.first.name).to eq("Ribose Inc.")
    end
  end

  describe ".create" do
    it "creates a new sub container" do
      stub_digicert_container_create_api(**container_attributes)
      container = Digicert::Container.create(**container_attributes)

      expect(container.id).not_to be_nil
    end
  end

  describe ".fetch" do
    it "retrieves the details for a container" do
      container_id = 123_456_789

      stub_digicert_container_fetch_api(container_id)
      container = Digicert::Container.fetch(container_id)

      expect(container.name).not_to be_nil
      expect(container.parent_id).not_to be_nil
      expect(container.allowed_domain_names.first).to eq("abc.xyz")
    end
  end

  def container_attributes
    {
      container_id: 123_456_789,
      name: "History Department",
      template_id: 5,
      description: "History, Civ, Ancient Languages",
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
digicert-1.0.0 spec/digicert/container_spec.rb