2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2016-11-25 16:10:37 +00:00
|
|
|
require 'rails_helper'
|
2017-03-27 09:25:45 +00:00
|
|
|
require 'lib/import/otrs/dynamic_field_examples'
|
2016-11-25 16:10:37 +00:00
|
|
|
|
|
|
|
RSpec.describe Import::OTRS::DynamicField::Dropdown do
|
|
|
|
it_behaves_like 'Import::OTRS::DynamicField'
|
|
|
|
|
|
|
|
it 'imports an OTRS Dropdown DynamicField' do
|
|
|
|
|
|
|
|
zammad_structure = {
|
2018-12-19 17:31:51 +00:00
|
|
|
object: 'Ticket',
|
|
|
|
name: 'dropdown_example',
|
|
|
|
display: 'Dropdown Example',
|
|
|
|
screens: {
|
2016-11-25 16:10:37 +00:00
|
|
|
view: {
|
|
|
|
'-all-' => {
|
|
|
|
shown: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
active: true,
|
|
|
|
editable: true,
|
|
|
|
position: '30',
|
|
|
|
created_by_id: 1,
|
|
|
|
updated_by_id: 1,
|
|
|
|
data_type: 'select',
|
|
|
|
data_option: {
|
2018-12-19 17:31:51 +00:00
|
|
|
default: '',
|
|
|
|
multiple: false,
|
|
|
|
options: {
|
2016-11-25 16:10:37 +00:00
|
|
|
'Hamburg' => 'Hamburg',
|
|
|
|
'München' => 'München',
|
|
|
|
'Köln' => 'Köln',
|
|
|
|
'Berlin' => 'Berlin'
|
|
|
|
},
|
2017-08-23 14:41:01 +00:00
|
|
|
nulloption: true,
|
|
|
|
null: true,
|
|
|
|
translate: false
|
2016-11-25 16:10:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dynamic_field_from_json('dropdown/default', zammad_structure)
|
|
|
|
end
|
2022-05-10 10:21:53 +00:00
|
|
|
|
|
|
|
context 'without possible values' do
|
|
|
|
it 'imports no field without possible value' do
|
|
|
|
allow(ObjectManager::Attribute).to receive(:add)
|
|
|
|
|
|
|
|
described_class.new(load_dynamic_field_json('dropdown/without_possible_values'))
|
|
|
|
|
|
|
|
expect(ObjectManager::Attribute).not_to have_received(:add)
|
|
|
|
end
|
|
|
|
end
|
2016-11-25 16:10:37 +00:00
|
|
|
end
|