Sha256: 0958c5e78e4209db375edf69e02b0d4a946fa5c59eb79084fbe9e76c2c32dee2

Contents?: true

Size: 1.96 KB

Versions: 28

Compression:

Stored size: 1.96 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

require 'gooddata/bricks/brick'
require 'gooddata/bricks/bricks'
require 'gooddata/bricks/middleware/aws_middleware'

describe GoodData::Bricks::AWSMiddleware do
  it 'should do nothing if the key "aws_client" is not there at all' do
    middleware = GoodData::Bricks::AWSMiddleware.new(app: lambda {|params| 'Doing nothing'})
    middleware.call({})
  end

  it 'should fail gracefully if value aws_client param not present even though the key is' do
    middleware = GoodData::Bricks::AWSMiddleware.new(app: lambda {|params| 'Doing nothing'})
    expect do
      middleware.call('aws_client' => nil)
    end.to raise_exception 'Unable to connect to AWS. Parameter "aws_client" seems to be empty'
  end

  it 'should fail gracefully if value secret_access_key is missing' do
    middleware = GoodData::Bricks::AWSMiddleware.new(app: lambda {|params| 'Doing nothing'})
    expect do
      middleware.call('aws_client' => {
        'access_key_id' => 'something'
      })
    end.to raise_exception 'Unable to connect to AWS. Parameter "secret_access_key" is missing'
  end

  it 'should fail gracefully if value access_key_id is missing' do
    middleware = GoodData::Bricks::AWSMiddleware.new(app: lambda {|params| 'Doing nothing'})
    expect do
      middleware.call('aws_client' => {
        'secret_access_key' => 'something'
      })
    end.to raise_exception 'Unable to connect to AWS. Parameter "access_key_id" is missing'
  end

  it "should preapre aws middleware for aws_client param" do
    middleware = GoodData::Bricks::AWSMiddleware.new(app: lambda do |params|
      expect(params['aws_client']['s3_client']).to be_kind_of(AWS::S3)
    end)
    middleware.call('aws_client' => {
      'secret_access_key' => 'something',
      'access_key_id' => 'something'
    })
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
gooddata-0.6.49 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.48 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.47 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.46 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.45 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.44 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.43 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.42 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.41 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.40 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.39 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.38 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.37 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.36 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.35 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.34 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.33 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.32 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.31 spec/unit/bricks/middleware/aws_middelware_spec.rb
gooddata-0.6.30 spec/unit/bricks/middleware/aws_middelware_spec.rb