Sha256: 9d5674eb7429fbcdda50d4e2a91cdbe195f77ff5350ed9ae8e6dca38a2618699

Contents?: true

Size: 1.74 KB

Versions: 21

Compression:

Stored size: 1.74 KB

Contents

require "spec_helper"

describe Fog::Brightbox::Compute do
  describe "when global config is available" do
    before do
      @arguments = {
        :brightbox_auth_url => "http://localhost",
        :brightbox_api_url => "http://localhost",
        :brightbox_client_id => "",
        :brightbox_secret => "",
        :brightbox_username => "",
        :brightbox_password => "",
        :brightbox_account => ""
      }

      @credential_guard = Minitest::Mock.new
      def @credential_guard.reject
        {}
      end

      Fog.stub :credentials, @credential_guard do
        @service = Fog::Brightbox::Compute.new(@arguments)
      end
    end

    it "responds to #request" do
      assert_respond_to @service, :request
    end

    it "responds to #request_access_token" do
      assert_respond_to @service, :request_access_token
    end

    it "responds to #wrapped_request" do
      assert_respond_to @service, :wrapped_request
    end
  end

  describe "when created without required arguments" do
    it "raises an error" do
      Fog.stub :credentials, {} do
        assert_raises ArgumentError do
          Fog::Brightbox::Compute.new({})
        end
      end
    end
  end

  describe "when created with a Config object" do
    it "does not error" do
      @options = {
        :brightbox_client_id => "cli-12345",
        :brightbox_secret => "1234567890"
      }
      @config = Fog::Brightbox::Config.new(@options)
      @service = Fog::Brightbox::Compute.new(@config)
      pass
    end
  end

  describe "when created with Config missing required settings" do
    it "raises ArgumentError"do
      @config = Fog::Brightbox::Config.new({})
      assert_raises ArgumentError do
        @service = Fog::Brightbox::Compute.new(@config)
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
fog-brightbox-1.10.0 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.9.1 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.9.0 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.8.2 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.8.1 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.8.0 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.7.3 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.7.2 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.7.1 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.7.0 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.6.0 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.5.0 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.5.0.rc1 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.4.2 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.4.1 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.4.0 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.3.0 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.2.0 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.1.0 spec/fog/compute/brightbox_spec.rb
fog-brightbox-1.0.0 spec/fog/compute/brightbox_spec.rb