Sha256: 48936b3d85ddac5a3c5b0ba80aa0612872dab8e6849ced64fb998a841c634544

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 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_technical_users_project'
require 'gooddata/lcm/lcm2'

shared_examples 'a technical users domain action' do
  it 'adds technical user to the domain' do
    expect(domain).to receive(:add_user)
      .with(login: 'foo@bar.com', email: 'foo@bar.com')
    subject.class.call(params)
  end
end

describe GoodData::LCM2::EnsureTechnicalUsersDomain do
  let(:gdc_gd_client) { double(:gdc_gd_client) }
  let(:domain) { double(:domain) }
  let(:user) { double(:user) }
  before do
    allow(gdc_gd_client).to receive(:domain) { domain }
    allow(domain).to receive(:users) { [] }
    allow(user).to receive(:login)
    allow(user).to receive(:email)
    allow(domain).to receive(:add_user) { user }
  end

  context 'when deprecated param technical_user specified' do
    let(:params) do
      params = {
        gdc_gd_client: gdc_gd_client,
        domain: domain,
        technical_user: ['foo@bar.com']
      }
      GoodData::LCM2.convert_to_smart_hash(params)
    end
    it_behaves_like 'a technical users domain action'
  end

  context 'when param technical_users specified' do
    let(:params) do
      params = {
        gdc_gd_client: gdc_gd_client,
        domain: domain,
        technical_users: ['foo@bar.com']
      }
      GoodData::LCM2.convert_to_smart_hash(params)
    end
    it_behaves_like 'a technical users domain action'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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