Sha256: 2231994d160fb276f609ca283f7e07dda9f51a310b91dab640b59cd764d15fae

Contents?: true

Size: 1011 Bytes

Versions: 5

Compression:

Stored size: 1011 Bytes

Contents

require 'spec_helper'

module Jellyfish
  module Fog
    module AWS
      describe Storage do
        it 'provisions and retires storage using fog' do
          enable_aws_fog_provisioning

          Storage.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 include('key' => "id-#{order_item.uuid}")

          Storage.new(order_item).retire

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

        def order_item
          @order_item ||= OpenStruct.new.tap do |order_item|
            order_item.uuid = '1234567890'
          end
        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/storage_spec.rb
jellyfish_fog_aws-0.2.2 spec/lib/jellyfish_fog_aws/storage_spec.rb
jellyfish_fog_aws-0.2.1 spec/lib/jellyfish_fog_aws/storage_spec.rb
jellyfish_fog_aws-0.2.0 spec/lib/jellyfish_fog_aws/storage_spec.rb
jellyfish_fog_aws-0.1.1 spec/lib/jellyfish_fog_aws/storage_spec.rb