Sha256: 811b5d30134922239e514861eb0bd74c69f66412699858bd46bdd3a482e75b24

Contents?: true

Size: 1.79 KB

Versions: 24

Compression:

Stored size: 1.79 KB

Contents

require "spec_helper"

describe Brightbox::Account do
  before do
    skip "recordings corrupted and no longer working"
  end

  describe ".get" do
    context "when connected using an application" do
      before do
        Brightbox::Api.configuration = USER_APP_CONFIG
      end

      context "and the account is accessible", vcr: true do
        before do
          @account_id = "acc-12345"
          @account = Brightbox::Account.get(@account_id)
        end

        it "returns requested account" do
          expect(@account).to be_kind_of(Fog::Compute::Brightbox::Account)
          expect(@account.id).to eql(@account_id)
        end

        it "returns the resource on the same connection" do
          expect(@account.service).to eql(Brightbox::Account.conn)
        end
      end

      context "and the account is unknown", vcr: true do
        it "returns nil" do
          expect(Brightbox::Account.get("acc-xxxxx")).to be_nil
        end
      end
    end

    context "when connected using an client", vcr: true do
      before do
        Brightbox::Api.configuration = API_CLIENT_CONFIG
      end

      context "and the account is accessible", vcr: true do
        before do
          @account_id = "acc-12345"
          @account = Brightbox::Account.get(@account_id)
        end

        it "returns the client's owning account" do
          expect(@account).to be_kind_of(Fog::Compute::Brightbox::Account)
          expect(@account.id).to eql(@account_id)
        end

        it "returns the resource on the same connection" do
          expect(@account.service).to eql(Brightbox::Account.conn)
        end
      end

      context "and the account is unknown", vcr: true do
        it "returns nil" do
          expect(Brightbox::Account.get("acc-xxxxx")).to be_nil
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
brightbox-cli-2.12.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.11.2 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.11.1 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.11.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.10.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.9.3 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.9.2 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.9.1 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.9.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.8.2 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.8.1 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.8.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.7.1 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.7.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.6.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.5.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.4.1 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.4.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.3.4 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-2.3.3 spec/unit/brightbox/account/get_spec.rb