Sha256: 2816c1184b4c0e50f522f0d83347923699859690d1079155f8447009a5f35ac7

Contents?: true

Size: 1.21 KB

Versions: 11

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe Aerosol::Env do
  describe '#deploy' do
    let(:name) { "unique_name_#{Time.now.to_i}".to_sym }
    let!(:deploy) { Aerosol.deploy(name) { } }

    it 'adds a deploy to the list of deploys' do
      expect { subject.deploy(name) }
        .to change { subject.deploy }
        .from(nil)
        .to([deploy])
    end
  end

  describe '#perform_role_assumption' do
    context 'when assume_role is nil' do
      it 'does not change the aws config' do
        expect(Aws).to_not receive(:config)
      end
    end

    context 'when assume_role exists' do
      let(:assume_role) { 'arn:aws:sts::123456789123:role/role-aerosol' }

      before do
        Aerosol::AWS.sts.stub_responses(
          :assume_role,
          credentials: {
            access_key_id: '123',
            secret_access_key: '456',
            session_token: '789',
            expiration: Time.new + 60
          }
        )
      end

      after do
        Aws.config.update(credentials: nil)
      end

      it 'should set the Aws.config[:credentials]' do
        subject.assume_role(assume_role)
        expect { subject.perform_role_assumption }
          .to change { Aws.config[:credentials] }
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
aerosol-1.10.0 spec/aerosol/env_spec.rb
aerosol-1.9.2 spec/aerosol/env_spec.rb
aerosol-1.9.1 spec/aerosol/env_spec.rb
aerosol-1.9.0 spec/aerosol/env_spec.rb
aerosol-1.8.0 spec/aerosol/env_spec.rb
aerosol-1.7.1 spec/aerosol/env_spec.rb
aerosol-1.7.0 spec/aerosol/env_spec.rb
aerosol-1.7.0.pre.1 spec/aerosol/env_spec.rb
aerosol-1.6.0 spec/aerosol/env_spec.rb
aerosol-1.5.1 spec/aerosol/env_spec.rb
aerosol-1.3.0 spec/aerosol/env_spec.rb