date_time_spec.rb 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. require 'lib/import/otrs/dynamic_field_examples'
  4. # this require is required (hehe) because of Rails autoloading
  5. # which causes this error:
  6. # warning: toplevel constant DateTime referenced by Import::OTRS::DynamicField::DateTime
  7. # and rspec thinks we want to test Date and stores it into described_class...
  8. require 'import/otrs/dynamic_field/date_time'
  9. RSpec.describe Import::OTRS::DynamicField::DateTime do
  10. it_behaves_like 'Import::OTRS::DynamicField'
  11. it 'imports an OTRS DateTime DynamicField' do
  12. zammad_structure = {
  13. object: 'Ticket',
  14. name: 'date_time_example',
  15. display: 'DateTime Example',
  16. screens: {
  17. view: {
  18. '-all-' => {
  19. shown: true
  20. }
  21. }
  22. },
  23. active: true,
  24. editable: false,
  25. position: '16',
  26. created_by_id: 1,
  27. updated_by_id: 1,
  28. data_type: 'datetime',
  29. data_option: {
  30. future: true,
  31. past: true,
  32. diff: 72,
  33. null: true
  34. }
  35. }
  36. dynamic_field_from_json('date_time/default', zammad_structure)
  37. end
  38. end