Sha256: 176ef8d2dbaa22aa95adf5d9434d3e1db45cf2c699177f9739452681f723fb18

Contents?: true

Size: 1.73 KB

Versions: 6

Compression:

Stored size: 1.73 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.

describe GoodData::LCM2::CollectDataProduct do
  it 'Has GoodData::Bricks::DefaultDataProductMiddleware class' do
    GoodData::LCM2::CollectDataProduct.should_not be(nil)
  end

  let(:client) { double(:client) }
  let(:domain) { double(:domain) }
  let(:gdc_logger) { double(:gdc_logger) }
  let(:data_product) { GoodData::DataProduct.new({}) }

  before do
    allow(client).to receive(:domain) { domain }
    allow(gdc_logger).to receive(:info)
    allow(domain).to receive(:data_products) { data_product }
  end

  context 'when data_product parameter is passed' do
    let(:data_product_id) { 'data-product' }
    let(:params) do
      params = {
        gdc_gd_client: client,
        gdc_logger: gdc_logger,
        data_product: data_product_id
      }
      GoodData::LCM2.convert_to_smart_hash(params)
    end

    it 'collects the specified data_product object' do
      expect(domain).to receive(:data_products).with(data_product_id)
      result = subject.class.call(params)
      expect(result[:params][:data_product]).to be_a GoodData::DataProduct
    end
  end

  context 'when no data_product parameter is passed' do
    let(:params) do
      params = {
        gdc_gd_client: client,
        gdc_logger: gdc_logger
      }
      GoodData::LCM2.convert_to_smart_hash(params)
    end

    it "collects the 'default' data_product" do
      expect(domain).to receive(:data_products).with('default')
      result = subject.class.call(params)
      expect(result[:params][:data_product]).to be_a GoodData::DataProduct
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gooddata-1.0.2-java spec/unit/actions/collect_data_product_spec.rb
gooddata-1.0.2 spec/unit/actions/collect_data_product_spec.rb
gooddata-1.0.1 spec/unit/actions/collect_data_product_spec.rb
gooddata-1.0.1-java spec/unit/actions/collect_data_product_spec.rb
gooddata-1.0.0-java spec/unit/actions/collect_data_product_spec.rb
gooddata-1.0.0 spec/unit/actions/collect_data_product_spec.rb