Sha256: 443679ece45a2320a118e36b2b61017858d9a71cec86172c29609a4d19d0ac62

Contents?: true

Size: 989 Bytes

Versions: 2

Compression:

Stored size: 989 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_any_instance_of(::Provisioner).to receive(:aws_settings).and_return(
            access_key: 'text', secret_key: 'text'
          )
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jellyfish_fog_aws-0.1.0 spec/lib/jellyfish_fog_aws/infrastructure_spec.rb
jellyfish_fog_aws-0.0.1 spec/lib/jellyfish_fog_aws/infrastructure_spec.rb