Sha256: c9ab0aea7c03b6cf81e4ac02545797e70314be2ec1c7433211038f547f07a7d0
Contents?: true
Size: 1.75 KB
Versions: 2
Compression:
Stored size: 1.75 KB
Contents
require "spec_helper" RSpec.describe Brightbox::LoadBalancer, "#formatted_acme_domains" do subject(:load_balancer) { Brightbox::LoadBalancer.new(fog_model) } let(:fog_model) do double( "Fog::Compute::Brightbox::LoadBalancer", id: "lba-12345", attributes: lba_attributes ) end let(:lba_attributes) do # Encode/decode JSON to get final key/value forms JSON.parse({ id: "lba-12345", acme: acme_details }.to_json) end context "when ACME is not setup" do let(:acme_details) { nil } it "returns an empty array" do expect(load_balancer.formatted_acme_domains).to eq("") end end context "when no domains are returned" do let(:acme_details) do { domains: [] } end it "returns an empty array" do expect(load_balancer.formatted_acme_domains).to eq("") end end context "when multiple domains are returned" do let(:acme_details) do { domains: [ { identifier: "example.com", status: "verified" }, { identifier: "example.net", status: "pending" } ] } end let(:expected_formatting) do "example.com:verified,example.net:pending" end it "returns a comma separated list of domains and statuses" do expect(load_balancer.formatted_acme_domains).to eq(expected_formatting) end end context "when error occurs" do let(:lba_attributes) do # Encode/decode JSON to get final key/value forms JSON.parse({ id: "lba-12345", acme: { domains: nil } }.to_json) end it "returns an empty array" do expect(load_balancer.formatted_acme_domains).to eq("") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
brightbox-cli-5.0.0.rc2 | spec/unit/brightbox/load_balancer/formatted_acme_domains_spec.rb |
brightbox-cli-5.0.0.rc1 | spec/unit/brightbox/load_balancer/formatted_acme_domains_spec.rb |