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
|
|
|
|
|
|
|
# this require is required (hehe) because of Rails autoloading
|
|
|
|
# which causes this error:
|
|
|
|
# warning: toplevel constant Date referenced by Import::OTRS::DynamicField::Date
|
|
|
|
# and rspec thinks we want to test Date and stores it into described_class...
|
|
|
|
require 'import/otrs/dynamic_field/date'
|
|
|
|
|
|
|
|
RSpec.describe Import::OTRS::DynamicField::Date do
|
|
|
|
it_behaves_like 'Import::OTRS::DynamicField'
|
|
|
|
|
|
|
|
it 'imports an OTRS Date DynamicField' do
|
|
|
|
|
|
|
|
zammad_structure = {
|
|
|
|
object: 'Ticket',
|
|
|
|
name: 'date_example',
|
|
|
|
display: 'Date Example',
|
|
|
|
screens: {
|
|
|
|
view: {
|
|
|
|
'-all-' => {
|
|
|
|
shown: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
active: true,
|
|
|
|
editable: true,
|
|
|
|
position: '40',
|
|
|
|
created_by_id: 1,
|
|
|
|
updated_by_id: 1,
|
|
|
|
data_type: 'date',
|
|
|
|
data_option: {
|
|
|
|
future: false,
|
|
|
|
past: false,
|
|
|
|
diff: 0,
|
2017-08-23 14:41:01 +00:00
|
|
|
null: true
|
2016-11-25 16:10:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dynamic_field_from_json('date/default', zammad_structure)
|
|
|
|
end
|
|
|
|
end
|