Sha256: 2fc0e09097d206be7b235283dc67e1fef8b4a3c917718f65543b0518aec56799

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require "spec_helper"

describe Brightbox::Account do
  before do
    # Unfortunately need to change $config for Api.conn to work until we can
    # eliminate the global class method
    $config = config_from_contents(contents)
  end

  describe ".all" do
    context "when connected using an application", vcr: true do
      let(:contents) { USER_APP_CONFIG_CONTENTS }

      it "returns a collection of Accounts" do
        expect(Brightbox::Account.all).to be_kind_of(Array)

        Brightbox::Account.all.each do |account|
          expect(account).to be_kind_of(Fog::Compute::Brightbox::Account)
        end
      end

      it "returns resources on the same connection" do
        Brightbox::Account.all.each do |account|
          expect(account.service).to eql(Brightbox::Account.conn)
        end
      end
    end

    context "when connected using an client", vcr: true do
      let(:contents) { API_CLIENT_CONFIG_CONTENTS }

      it "returns a collection of Accounts" do
        expect(Brightbox::Account.all).to be_kind_of(Array)

        Brightbox::Account.all.each do |account|
          expect(account).to be_kind_of(Fog::Compute::Brightbox::Account)
        end
      end

      it "returns resources on the same connection" do
        Brightbox::Account.all.each do |account|
          expect(account.service).to eql(Brightbox::Account.conn)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
brightbox-cli-2.2.0 spec/unit/brightbox/account/all_spec.rb