Sha256: acc0906fb4ca01a8d153712072a85af6e46478a81a09f18a0187d5b13ca1df47

Contents?: true

Size: 1.18 KB

Versions: 7

Compression:

Stored size: 1.18 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/lcm/actions/ensure_data_product'
require 'gooddata/lcm/lcm2'

describe GoodData::LCM2::EnsureDataProduct do
  context 'when data_product parameter is passed' do
    let(:client) { double(:client) }
    let(:domain) { double(:domain) }
    let(:data_product) { GoodData::DataProduct.new({}) }
    let(:gdc_logger) { double(:gdc_logger) }

    let(:params) do
      params = {
        data_product: "data-product-#{SecureRandom.uuid}",
        gdc_gd_client: client,
        gdc_logger: gdc_logger
      }
      GoodData::LCM2.convert_to_smart_hash(params)
    end

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

    it 'creates the data_product' do
      expect(domain).to receive(:create_data_product)
      subject.class.call(params)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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