Sha256: e29bb6c9519f61a258d30628af7704908952cf475a236c467d334f9db233797d
Contents?: true
Size: 1.04 KB
Versions: 12
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true require "rails_helper" RSpec.describe CloudGovConfig, type: :model do subject { described_class } describe ".dig" do context "VCAP_SERVICES is blank" do it "returns nil" do expect(subject.dig(:s3, :credentials, :bucket)).to be_nil end end context "VCAP_SERVICES is set" do let(:bucket_name) { "bucket-name" } let(:vcap) { { s3: [ { credentials: { bucket: bucket_name } } ] } } around do |example| ClimateControl.modify VCAP_SERVICES: vcap.to_json do example.run end end it "can find a path" do expect(subject.dig(:s3, :credentials, :bucket)).to eq bucket_name end it "returns nil for a missing path" do expect(subject.dig(:s3, :missing)).to be_nil end it "returns nil for a missing service" do expect(subject.dig(:rds, :credentials)).to be_nil end end end end
Version data entries
12 entries across 12 versions & 1 rubygems