Sha256: 82bf56fcb9c5d2ad12dffc38b1ec227cffde94cdf9176adc7ea95b47bc69e988

Contents?: true

Size: 1.65 KB

Versions: 9

Compression:

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

describe GoodData::LCM2::RenameExistingClientProjects do
  let(:gdc_gd_client) { double('gdc_gd_client') }
  let(:domain) { double('domain') }
  let(:client) { double('client') }
  let(:project) { double('project') }

  context 'client project is existing in input source' do
    let(:params) do
      params = {
        gdc_gd_client: gdc_gd_client,
        organization: domain,
        clients: [
          {
            id: 'Id',
            settings: [
              {
                name: 'lcm.title',
                value: 'renamed project'
              }
            ]
          }
        ],
        client_projects: {
          'Id' => { segment_client: client, project: project }
        }
      }
      GoodData::LCM2.convert_to_smart_hash(params)
    end

    before do
      allow(gdc_gd_client).to receive(:domain) { domain }
      allow(client).to receive(:project) { project }
      allow(project).to receive(:pid) { '123456789' }
      allow(project).to receive(:title) { "old project" }
      allow(project).to receive(:title=)
      allow(project).to receive(:save)
    end

    it 'rename client project title' do
      expect(project).to receive(:title=).with('renamed project')
      result = subject.class.call(params)
      expect(result).to eq [{ id: 'Id', pid: '123456789', old_title: 'old project', new_title: 'renamed project' }]
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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