Sha256: 208629bdd8d733bf4e53a20f494660e5f8217429381c42b832d871c1bd182c92

Contents?: true

Size: 1.79 KB

Versions: 23

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::Brightbox::Compute::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::Brightbox::Compute::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

23 entries across 23 versions & 1 rubygems

Version Path
brightbox-cli-5.0.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-5.0.0.rc2 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-5.0.0.rc1 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-5.0.0.alpha spec/unit/brightbox/account/get_spec.rb
brightbox-cli-4.8.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-4.7.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-4.6.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-4.5.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-4.5.0.rc1 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-4.4.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-4.3.2 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-4.3.1 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-4.3.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-4.2.1 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-4.2.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-4.1.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-4.0.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-4.0.0.rc2 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-3.3.0 spec/unit/brightbox/account/get_spec.rb
brightbox-cli-3.2.0 spec/unit/brightbox/account/get_spec.rb