Sha256: e5bc42d3806893129f848b257b521a0afa4d500c1dce90a3e0398bbbd99e1ea2

Contents?: true

Size: 1.77 KB

Versions: 1

Compression:

Stored size: 1.77 KB

Contents

require "minitest/autorun"
require "fog/brightbox"

describe Fog::Compute::Brightbox 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::Compute::Brightbox.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::Compute::Brightbox.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::Compute::Brightbox.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::Compute::Brightbox.new(@config)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-brightbox-0.1.0.dev2 spec/fog/compute/brightbox_spec.rb