Sha256: d06491c6f41c80c713362fffae0c86580bd49ecd32e2f059fa8b49fb4f2be54a

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe Vcloud::Core::Fog::Login do
  before(:each) do
    stub_const('ENV', {})

    @orig_credential = ::Fog.credential
    ::Fog.credential = 'null'
    @orig_credentials_path = ::Fog.credentials_path
    ::Fog.credentials_path = '/dev/null'
  end

  after(:each) do
    ::Fog.credential = @orig_credential
    ::Fog.credentials_path = @orig_credentials_path
  end

  describe "#token" do
    context "unable to load credentials" do
      it "should raise an exception succinctly listing the missing credentials" do
        # This test is known to fail with a TypeError due to a bug in Ruby 1.9.3 that
        # has since been fixed. See https://github.com/gds-operations/vcloud-core/pull/100
        expect { ::Fog.credentials['doesnotexist'] }.to raise_error(
          Fog::Errors::LoadError,
          /^Missing Credentials\n/
        )
        expect { subject.token('supersekret') }.to raise_error(
          ArgumentError,
          /^Missing required arguments: vcloud_director_.*$/
        )
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vcloud-core-0.10.0 spec/integration/core/fog/login_spec.rb
vcloud-core-0.9.0 spec/integration/core/fog/login_spec.rb
vcloud-core-0.8.0 spec/integration/core/fog/login_spec.rb