Merge branch 'develop' of git.znuny.com:zammad/zammad into develop
This commit is contained in:
commit
09b1e9ea9b
3 changed files with 12 additions and 3 deletions
|
@ -48,7 +48,7 @@ module Import
|
||||||
|
|
||||||
# only update roles if different (reduce sql statements)
|
# only update roles if different (reduce sql statements)
|
||||||
if @local_customer.role_ids == customer[:role_ids]
|
if @local_customer.role_ids == customer[:role_ids]
|
||||||
user.delete(:role_ids)
|
customer.delete(:role_ids)
|
||||||
end
|
end
|
||||||
|
|
||||||
log "update User.find_by(login: #{customer[:login]})"
|
log "update User.find_by(login: #{customer[:login]})"
|
||||||
|
|
|
@ -13,7 +13,10 @@ RSpec.describe Import::OTRS::CustomerUser do
|
||||||
def updates_with(zammad_structure)
|
def updates_with(zammad_structure)
|
||||||
expect_organization_lookup
|
expect_organization_lookup
|
||||||
expect(import_object).to receive(:find_by).and_return(existing_object)
|
expect(import_object).to receive(:find_by).and_return(existing_object)
|
||||||
expect(existing_object).to receive(:role_ids).and_return([]).at_least(:once)
|
# we delete the :role_ids from the zammad_structure to make sure that
|
||||||
|
# a) role_ids call returns the initial role_ids
|
||||||
|
# b) and update_attributes gets called without them
|
||||||
|
expect(existing_object).to receive(:role_ids).and_return(zammad_structure.delete(:role_ids)).at_least(:once)
|
||||||
expect(existing_object).to receive(:update_attributes).with(zammad_structure)
|
expect(existing_object).to receive(:update_attributes).with(zammad_structure)
|
||||||
expect(import_object).not_to receive(:new)
|
expect(import_object).not_to receive(:new)
|
||||||
start_import_test
|
start_import_test
|
||||||
|
|
|
@ -12,12 +12,18 @@ RSpec.describe Import::OTRS::User do
|
||||||
|
|
||||||
def updates_with(zammad_structure)
|
def updates_with(zammad_structure)
|
||||||
expect(import_object).to receive(:find_by).and_return(existing_object)
|
expect(import_object).to receive(:find_by).and_return(existing_object)
|
||||||
expect(existing_object).to receive(:role_ids).and_return([])
|
# we delete the :role_ids from the zammad_structure to make sure that
|
||||||
|
# a) role_ids call returns the initial role_ids
|
||||||
|
# b) and update_attributes gets called without them
|
||||||
|
expect(existing_object).to receive(:role_ids).and_return(zammad_structure.delete(:role_ids))
|
||||||
expect(existing_object).to receive(:update_attributes).with(zammad_structure)
|
expect(existing_object).to receive(:update_attributes).with(zammad_structure)
|
||||||
expect(import_object).not_to receive(:new)
|
expect(import_object).not_to receive(:new)
|
||||||
start_import_test
|
start_import_test
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def role_delete_expecations(role_ids)
|
||||||
|
end
|
||||||
|
|
||||||
def load_user_json(file)
|
def load_user_json(file)
|
||||||
json_fixture("import/otrs/user/#{file}")
|
json_fixture("import/otrs/user/#{file}")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue