Sha256: 7c6de58c339c399853841ecdfe0b63dc1897e7746bbdddc0c05d3b52c50b1edd

Contents?: true

Size: 853 Bytes

Versions: 8

Compression:

Stored size: 853 Bytes

Contents

require 'spec_helper'

describe Vcloud::Core::Fog do
  describe "fog_credentials_pass" do
    let(:subject) { Vcloud::Core::Fog::fog_credentials_pass }

    context "vcloud_director_password not set" do
      it "should return nil" do
        expect(::Fog).to receive(:credentials).and_return({})
        expect(subject).to eq(nil)
      end
    end

    context "vcloud_director_password set" do
      it "should return string" do
        expect(::Fog).to receive(:credentials).and_return({
          :vcloud_director_password => 'supersekret',
        })
        expect(subject).to eq('supersekret')
      end
    end

    context "Fog LoadError" do
      it "should suppress exception and return nil" do
        expect(::Fog).to receive(:credentials).and_raise(::Fog::Errors::LoadError)
        expect(subject).to eq(nil)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vcloud-core-0.15.0 spec/vcloud/core/fog_spec.rb
vcloud-core-0.14.0 spec/vcloud/core/fog_spec.rb
vcloud-core-0.13.0 spec/vcloud/core/fog_spec.rb
vcloud-core-0.12.0 spec/vcloud/core/fog_spec.rb
vcloud-core-0.11.0 spec/vcloud/core/fog_spec.rb
vcloud-core-0.10.0 spec/vcloud/core/fog_spec.rb
vcloud-core-0.9.0 spec/vcloud/core/fog_spec.rb
vcloud-core-0.8.0 spec/vcloud/core/fog_spec.rb