Sha256: 8b94670789aceb619514982fd08251fdc43ee727afc13a1b8244257e63eca09b

Contents?: true

Size: 1.89 KB

Versions: 1

Compression:

Stored size: 1.89 KB

Contents

# -*- encoding: utf-8 -*-
#
# Author:: Tyler Ball (<tball@chef.io>)
#
# Copyright (C) 2015, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require "kitchen/driver/aws/client"
require "climate_control"

describe Kitchen::Driver::Aws::Client do

  let(:client) { Kitchen::Driver::Aws::Client.new("us-west-1") }

  describe "#initialize" do

    it "successfully creates a client" do
      expect(client).to be_a(Kitchen::Driver::Aws::Client)
    end

    it "Sets the AWS config" do
      client
      expect(Aws.config[:region]).to eq("us-west-1")
    end

    context "when provided all optional parameters" do
      let(:client) do
        Kitchen::Driver::Aws::Client.new(
          "us-west-1",
          "test-profile",
          "access_key_id",
          "secret_access_key",
          "session_token",
          "http_proxy",
          999,
          false
        )
      end
      it "Sets the AWS config" do
        client
        expect(Aws.config[:region]).to eq("us-west-1")
        expect(Aws.config[:profile]).to eq("test-profile")
        expect(Aws.config[:http_proxy]).to eq("http_proxy")
        expect(Aws.config[:retry_limit]).to eq(999)
        expect(Aws.config[:ssl_verify_peer]).to eq(false)
      end
    end
  end

  it "returns a client" do
    expect(client.client).to be_a(Aws::EC2::Client)
  end

  it "returns a resource" do
    expect(client.resource).to be_a(Aws::EC2::Resource)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kitchen-ec2-2.0.0 spec/kitchen/driver/ec2/client_spec.rb