Sha256: d4df803dc83d22e1d2ac46b145fac56bab92de011a465bc6f9753b88f6cfe673
Contents?: true
Size: 1.81 KB
Versions: 2
Compression:
Stored size: 1.81 KB
Contents
# encoding: UTF-8 # # Copyright (c) 2010-2017 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/helpers/data_helper' describe GoodData::Helpers::DataSource do before :each do @s3_client = double('s3_client') @bucket = double('bucket') @objects = double('objects') allow(@s3_client).to receive(:bucket) { @bucket } allow(@bucket).to receive(:object) { @objects } allow(@objects).to receive(:get) { StringIO.new('aaa') } @ds = GoodData::Helpers::DataSource.new(type: :s3, bucket: 'some_bucket', key: 'some_key') end it 'should be able to handle AWS' do expect(@ds.realized?).to be_falsey params = { 'aws_client' => { 's3_client' => @s3_client } } expect(@ds.realize(params)).to eq '2bdc6c8a02b2bd1d7997cf17f0848ecfcbceba25ca184e2676f19c054db7139b' expect(@ds.realized?).to be_truthy end it 'should gracefully handle missing aws client' do expect do @ds.realize('aws_client' => nil) end.to raise_exception "AWS client not present. Perhaps S3Middleware is missing in the brick definition?" end it 'should gracefully handle missing data source params - bucket' do ds = GoodData::Helpers::DataSource.new(type: :s3, key: 'some_key') params = { 'aws_client' => { 's3_client' => @s3_client } } expect do ds.realize(params) end.to raise_exception 'Key "bucket" is missing in S3 datasource' end it 'should gracefully handle missing data source params - key' do ds = GoodData::Helpers::DataSource.new(type: :s3, bucket: 'some_bucket') params = { 'aws_client' => { 's3_client' => @s3_client } } expect do ds.realize(params) end.to raise_exception 'Key "key" is missing in S3 datasource' end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gooddata-0.6.53 | spec/unit/helpers/data_helper_spec.rb |
gooddata-0.6.52 | spec/unit/helpers/data_helper_spec.rb |