Sha256: 499fa964edfaa6c14ce239215ea09826ad4176fd8785e2394a5846a7b054f58b

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 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/provision_clients'
require 'gooddata/lcm/actions/purge_clients'
require 'gooddata/lcm/lcm2'

describe GoodData::LCM2::ProvisionClients do
  let(:gdc_gd_client) { double('gdc_gd_client') }
  let(:domain) { double('domain') }
  let(:logger) { double('logger') }
  let(:segment) { double('segment') }
  let(:data_product) { double('data_product') }

  before do
    allow(gdc_gd_client).to receive(:domain).and_return(domain)
    allow(logger).to receive(:debug)
    allow(logger).to receive(:error).and_return({})
    allow(segment).to receive(:segment_id).and_return({})
    allow(segment).to receive(:provision_client_projects).and_raise('limit reached')
    allow(domain).to receive(:segments) { segment }
  end

  context 'when provisioning get errors' do
    let(:params) do
      params = {
        gdc_gd_client: gdc_gd_client,
        gdc_logger: logger,
        segments: [
          segment
        ],
        domain: domain,
        data_product: data_product
      }
      GoodData::LCM2.convert_to_smart_hash(params)
    end

    it 'clean all zombie clients' do
      expect(GoodData::LCM2::PurgeClients).to receive(:call).and_return(results: [], params: { client_projects: [] })
      expect { subject.class.call(params) }.to raise_error('limit reached')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gooddata-1.1.0-java spec/unit/actions/provision_clients_spec.rb
gooddata-1.1.0 spec/unit/actions/provision_clients_spec.rb