Sha256: e0599be7c78037c5e49d246d20d455d9f526eae9d5123645d0ebb4b46498efd8

Contents?: true

Size: 1015 Bytes

Versions: 5

Compression:

Stored size: 1015 Bytes

Contents

require 'spec_helper'

module Jellyfish
  module Fog
    module AWS
      describe Infrastructure do
        it 'provisions and retires infrastructure using fog' do
          enable_aws_fog_provisioning

          Infrastructure.new(order_item).provision

          expect(order_item.provision_status).to eq 'ok'
          order_item.payload_response = JSON.parse(order_item.payload_response)
          expect(order_item.payload_response).to have_key('id')
          expect(order_item.payload_response['image_id']).to eq('ami-acca47c4')

          Infrastructure.new(order_item).retire

          expect(order_item.provision_status).to eq 'retired'
        end

        def order_item
          @order_item ||= OpenStruct.new
        end

        def enable_aws_fog_provisioning
          ::Fog.mock!
          allow(ENV).to receive(:fetch).with('AWS_ACCESS_KEY_ID').and_return('text')
          allow(ENV).to receive(:fetch).with('AWS_SECRET_ACCESS_KEY').and_return('text')
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jellyfish_fog_aws-0.3.0 spec/lib/jellyfish_fog_aws/infrastructure_spec.rb
jellyfish_fog_aws-0.2.2 spec/lib/jellyfish_fog_aws/infrastructure_spec.rb
jellyfish_fog_aws-0.2.1 spec/lib/jellyfish_fog_aws/infrastructure_spec.rb
jellyfish_fog_aws-0.2.0 spec/lib/jellyfish_fog_aws/infrastructure_spec.rb
jellyfish_fog_aws-0.1.1 spec/lib/jellyfish_fog_aws/infrastructure_spec.rb