Sha256: 9ad14666e40b6af4382f62f5c8f2e11d773e33b26b13c7e32a3d38a807c91796

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

class TestObj
  include SimpleDeploy::AWS::Helpers
  attr_accessor :config
end

describe SimpleDeploy::AWS::Helpers do

  describe 'connection_args' do
    before do
      @config = stub 'config',
                     access_key: 'key',
                     secret_key: 'XXX',
                     region:     'us-west-1'
      @obj = TestObj.new

      @args = {
        aws_access_key_id:     'key',
        aws_secret_access_key: 'XXX',
        region:                'us-west-1'
      }
    end

    describe 'with long lived credentials' do
      before do
        @config.stub temporary_credentials?: false
        @obj.config = @config
      end

      it 'does not include security token' do
        @obj.connection_args.should eq @args
      end
    end

    describe 'with temporary credentials' do
      before do
        @config.stub security_token: 'token'
        @config.stub temporary_credentials?: true
        @obj.config = @config
      end

      it 'includes security security token' do
        args = @args.merge({aws_session_token: 'token'})
        @obj.connection_args.should eq args
      end
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
simple_deploy-0.10.2 spec/aws/helpers_spec.rb
simple_deploy-0.10.1 spec/aws/helpers_spec.rb
simple_deploy-0.10.0 spec/aws/helpers_spec.rb
simple_deploy-0.10.0.beta.3 spec/aws/helpers_spec.rb
simple_deploy-0.10.0.beta.2 spec/aws/helpers_spec.rb
simple_deploy-0.10.0.beta.1 spec/aws/helpers_spec.rb