Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions lib/gooddata/lcm/lcm2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,6 @@ def perform(mode, params = {})
end
end

check_unused_params(actions, params)

# Print name of actions to be performed for debug purposes
print_action_names(mode, actions)

# TODO: Check all action params first

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

skip_actions = (params.skip_actions || [])
actions = actions.reject do |action|
skip_actions.include?(action.to_s)
skip_actions.include?(action.name.split('::').last)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calls 'action.name' 2 times (DuplicateMethodCall)

end

check_unused_params(actions, params)
print_action_names(mode, actions)

# Run actions
errors = []
results = []
Expand Down
36 changes: 36 additions & 0 deletions spec/unit/lcm/lcm2_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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'

describe 'GoodData::LCM2' do
describe '#skip_actions' do
let(:client) { double(:client) }
let(:domain) { double(:domain) }
let(:logger) { double(:logger) }
let(:params) do
params = {
skip_actions: %w(CollectSegments SynchronizeUsers),
GDC_GD_CLIENT: client,
GDC_LOGGER: logger
}
GoodData::LCM2.convert_to_smart_hash(params)
end

before do
allow(client).to receive(:class) { GoodData::Rest::Client }
allow(client).to receive(:domain) { domain }
allow(logger).to receive(:info)
allow(domain).to receive(:data_products)
end

it 'skips actions in skip_actions' do
expect(GoodData::LCM2::CollectSegments).not_to receive(:call)
expect(GoodData::LCM2::SynchronizeUsers).not_to receive(:call)
GoodData::LCM2.perform('users', params)
end
end
end