Skip to content

Commit 8df9562

Browse files
authored
Merge pull request #1090 from kubamahnert/TMA-skip-actions
Fix skip actions
2 parents f0606ee + 6083387 commit 8df9562

2 files changed

Lines changed: 40 additions & 6 deletions

File tree

lib/gooddata/lcm/lcm2.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,6 @@ def perform(mode, params = {})
276276
end
277277
end
278278

279-
check_unused_params(actions, params)
280-
281-
# Print name of actions to be performed for debug purposes
282-
print_action_names(mode, actions)
283-
284279
# TODO: Check all action params first
285280

286281
new_params = params
@@ -299,9 +294,12 @@ def perform(mode, params = {})
299294

300295
skip_actions = (params.skip_actions || [])
301296
actions = actions.reject do |action|
302-
skip_actions.include?(action.to_s)
297+
skip_actions.include?(action.name.split('::').last)
303298
end
304299

300+
check_unused_params(actions, params)
301+
print_action_names(mode, actions)
302+
305303
# Run actions
306304
errors = []
307305
results = []

spec/unit/lcm/lcm2_spec.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# encoding: UTF-8
2+
#
3+
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
require 'gooddata/lcm/lcm2'
8+
9+
describe 'GoodData::LCM2' do
10+
describe '#skip_actions' do
11+
let(:client) { double(:client) }
12+
let(:domain) { double(:domain) }
13+
let(:logger) { double(:logger) }
14+
let(:params) do
15+
params = {
16+
skip_actions: %w(CollectSegments SynchronizeUsers),
17+
GDC_GD_CLIENT: client,
18+
GDC_LOGGER: logger
19+
}
20+
GoodData::LCM2.convert_to_smart_hash(params)
21+
end
22+
23+
before do
24+
allow(client).to receive(:class) { GoodData::Rest::Client }
25+
allow(client).to receive(:domain) { domain }
26+
allow(logger).to receive(:info)
27+
allow(domain).to receive(:data_products)
28+
end
29+
30+
it 'skips actions in skip_actions' do
31+
expect(GoodData::LCM2::CollectSegments).not_to receive(:call)
32+
expect(GoodData::LCM2::SynchronizeUsers).not_to receive(:call)
33+
GoodData::LCM2.perform('users', params)
34+
end
35+
end
36+
end

0 commit comments

Comments
 (0)